mirror of
https://github.com/MetaCubeX/metacubexd.git
synced 2024-11-10 05:15:35 +08:00
feat(config): toast error message when dns query failed for some reason, closes #321
This commit is contained in:
parent
fd235311d8
commit
82c2772afe
@ -9,6 +9,7 @@ import {
|
|||||||
createSignal,
|
createSignal,
|
||||||
onMount,
|
onMount,
|
||||||
} from 'solid-js'
|
} from 'solid-js'
|
||||||
|
import { toast } from 'solid-toast'
|
||||||
import { z } from 'zod'
|
import { z } from 'zod'
|
||||||
import {
|
import {
|
||||||
fetchBackendConfigAPI,
|
fetchBackendConfigAPI,
|
||||||
@ -56,7 +57,7 @@ const DNSQueryForm = () => {
|
|||||||
const { form, isSubmitting } = createForm<z.infer<typeof dnsQueryFormSchema>>(
|
const { form, isSubmitting } = createForm<z.infer<typeof dnsQueryFormSchema>>(
|
||||||
{
|
{
|
||||||
extend: validator({ schema: dnsQueryFormSchema }),
|
extend: validator({ schema: dnsQueryFormSchema }),
|
||||||
onSubmit: async (values) => {
|
onSubmit: (values) =>
|
||||||
request
|
request
|
||||||
.get('dns/query', {
|
.get('dns/query', {
|
||||||
searchParams: { name: values.name, type: values.type },
|
searchParams: { name: values.name, type: values.type },
|
||||||
@ -65,7 +66,7 @@ const DNSQueryForm = () => {
|
|||||||
.then(({ Answer }) =>
|
.then(({ Answer }) =>
|
||||||
setDNSQueryResult(Answer?.map(({ data }) => data) || []),
|
setDNSQueryResult(Answer?.map(({ data }) => data) || []),
|
||||||
)
|
)
|
||||||
},
|
.catch((err) => toast.error(err.message)),
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user