feat: improve error handling
This commit is contained in:
parent
eb7cc04256
commit
634073342b
@ -97,11 +97,15 @@ export const FormContentsPage = (properties: TProperties) => {
|
||||
const watchTags = watch('tags')
|
||||
|
||||
useEffect(() => {
|
||||
if (fetcher.data?.sucess) {
|
||||
toast.error(fetcher.data?.message)
|
||||
return
|
||||
}
|
||||
|
||||
if (fetcher.data?.success) {
|
||||
toast.success(`Artikel berhasil ${newsData ? 'diupdate' : 'dibuat'}!`)
|
||||
navigate('/lg-admin/contents')
|
||||
} else {
|
||||
toast.error(fetcher.data?.message)
|
||||
return
|
||||
}
|
||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||
}, [fetcher.data])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user