mirror of
https://github.com/Buriburizaem0n/admin-frontend-domain.git
synced 2026-05-06 05:38:51 +00:00
improve: add missing try-catch cases (#86)
* improve: add missing try-catch cases * i18n: support german * chore: auto-fix linting and formatting issues --------- Co-authored-by: uubulb <uubulb@users.noreply.github.com>
This commit is contained in:
+10
-1
@@ -39,6 +39,7 @@ import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useState } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
import { KeyedMutator } from "swr"
|
||||
import { z } from "zod"
|
||||
|
||||
@@ -84,7 +85,15 @@ export const CronCard: React.FC<CronCardProps> = ({ data, mutate }) => {
|
||||
const [open, setOpen] = useState(false)
|
||||
|
||||
const onSubmit = async (values: z.infer<typeof cronFormSchema>) => {
|
||||
data?.id ? await updateCron(data.id, values) : await createCron(values)
|
||||
try {
|
||||
data?.id ? await updateCron(data.id, values) : await createCron(values)
|
||||
} catch (e) {
|
||||
console.error(e)
|
||||
toast(t("Error"), {
|
||||
description: t("Results.UnExpectedError"),
|
||||
})
|
||||
return
|
||||
}
|
||||
setOpen(false)
|
||||
await mutate()
|
||||
form.reset()
|
||||
|
||||
Reference in New Issue
Block a user