feat: update success and error handling in form pages with toast notifications

This commit is contained in:
Ardeman
2025-03-12 20:20:30 +08:00
parent 0545190497
commit c0318fac4c
2 changed files with 12 additions and 13 deletions
+2 -2
View File
@@ -97,12 +97,12 @@ export const FormContentsPage = (properties: TProperties) => {
const watchTags = watch('tags')
useEffect(() => {
if (fetcher.data?.sucess) {
if (fetcher.data?.success === false) {
toast.error(fetcher.data?.message)
return
}
if (fetcher.data?.success) {
if (fetcher.data?.success === true) {
toast.success(`Artikel berhasil ${newsData ? 'diupdate' : 'dibuat'}!`)
navigate('/lg-admin/contents')
return