Skip to content

Commit

Permalink
feat(config): toast error message when dns query failed for some reas…
Browse files Browse the repository at this point in the history
…on, closes MetaCubeX#321
  • Loading branch information
kunish committed Oct 4, 2023
1 parent fd23531 commit 82c2772
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/pages/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
createSignal,
onMount,
} from 'solid-js'
import { toast } from 'solid-toast'
import { z } from 'zod'
import {
fetchBackendConfigAPI,
Expand Down Expand Up @@ -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 },
Expand All @@ -65,7 +66,7 @@ const DNSQueryForm = () => {
.then(({ Answer }) =>
setDNSQueryResult(Answer?.map(({ data }) => data) || []),
)
},
.catch((err) => toast.error(err.message)),
},
)

Expand Down

0 comments on commit 82c2772

Please sign in to comment.