mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-24 09:45: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>>({
|
||||
extend: validator({ schema }),
|
||||
async onSubmit(values) {
|
||||
const { ok } = await ky.get(values.url, {
|
||||
headers: values.secret
|
||||
async onSubmit({ url, secret }) {
|
||||
const { ok } = await ky.get(url, {
|
||||
headers: secret
|
||||
? {
|
||||
Authorization: `Bearer ${values.secret}`,
|
||||
Authorization: `Bearer ${secret}`,
|
||||
}
|
||||
: {},
|
||||
})
|
||||
|
||||
if (!ok) {
|
||||
return
|
||||
}
|
||||
if (!ok) return 1
|
||||
|
||||
setEndpointList([
|
||||
{
|
||||
id: uuid(),
|
||||
url: values.url,
|
||||
secret: values.secret,
|
||||
},
|
||||
...endpointList(),
|
||||
])
|
||||
const id = uuid()
|
||||
setEndpointList([{ id, url, secret }, ...endpointList()])
|
||||
setSelectedEndpoint(id)
|
||||
navigate('/overview')
|
||||
},
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user