feat(config): toast error message when dns query failed for some reason, closes #321

This commit is contained in:
kunish 2023-10-04 18:16:37 +08:00
parent fd235311d8
commit 82c2772afe
No known key found for this signature in database
GPG Key ID: 647A12B4F782C430

View File

@ -9,6 +9,7 @@ import {
createSignal,
onMount,
} from 'solid-js'
import { toast } from 'solid-toast'
import { z } from 'zod'
import {
fetchBackendConfigAPI,
@ -56,7 +57,7 @@ const DNSQueryForm = () => {
const { form, isSubmitting } = createForm<z.infer<typeof dnsQueryFormSchema>>(
{
extend: validator({ schema: dnsQueryFormSchema }),
onSubmit: async (values) => {
onSubmit: (values) =>
request
.get('dns/query', {
searchParams: { name: values.name, type: values.type },
@ -65,7 +66,7 @@ const DNSQueryForm = () => {
.then(({ Answer }) =>
setDNSQueryResult(Answer?.map(({ data }) => data) || []),
)
},
.catch((err) => toast.error(err.message)),
},
)