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')
|
const watchTags = watch('tags')
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (fetcher.data?.sucess) {
|
||||||
|
toast.error(fetcher.data?.message)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if (fetcher.data?.success) {
|
if (fetcher.data?.success) {
|
||||||
toast.success(`Artikel berhasil ${newsData ? 'diupdate' : 'dibuat'}!`)
|
toast.success(`Artikel berhasil ${newsData ? 'diupdate' : 'dibuat'}!`)
|
||||||
navigate('/lg-admin/contents')
|
navigate('/lg-admin/contents')
|
||||||
} else {
|
return
|
||||||
toast.error(fetcher.data?.message)
|
|
||||||
}
|
}
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
||||||
}, [fetcher.data])
|
}, [fetcher.data])
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user