Skip to content

Commit

Permalink
feat: route to override immediately after checking (#39)
Browse files Browse the repository at this point in the history
  • Loading branch information
PuerNya committed Aug 30, 2023
1 parent b64cfa3 commit b178161
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/pages/Setup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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')
},
})

Expand Down

0 comments on commit b178161

Please sign in to comment.