mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat: route to override immediately after checking (#39)
This commit is contained in:
parent
b64cfa3f9a
commit
b178161dbd
@ -18,27 +18,21 @@ export default () => {
|
|||||||
|
|
||||||
const { form } = createForm<z.infer<typeof schema>>({
|
const { form } = createForm<z.infer<typeof schema>>({
|
||||||
extend: validator({ schema }),
|
extend: validator({ schema }),
|
||||||
async onSubmit(values) {
|
async onSubmit({ url, secret }) {
|
||||||
const { ok } = await ky.get(values.url, {
|
const { ok } = await ky.get(url, {
|
||||||
headers: values.secret
|
headers: secret
|
||||||
? {
|
? {
|
||||||
Authorization: `Bearer ${values.secret}`,
|
Authorization: `Bearer ${secret}`,
|
||||||
}
|
}
|
||||||
: {},
|
: {},
|
||||||
})
|
})
|
||||||
|
|
||||||
if (!ok) {
|
if (!ok) return 1
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
setEndpointList([
|
const id = uuid()
|
||||||
{
|
setEndpointList([{ id, url, secret }, ...endpointList()])
|
||||||
id: uuid(),
|
setSelectedEndpoint(id)
|
||||||
url: values.url,
|
navigate('/overview')
|
||||||
secret: values.secret,
|
|
||||||
},
|
|
||||||
...endpointList(),
|
|
||||||
])
|
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user