feat: improve error handling and success messages in various forms and dialogs

This commit is contained in:
Ardeman
2025-03-15 09:16:57 +08:00
parent 405e57b92d
commit 6d99a37f20
9 changed files with 103 additions and 29 deletions
+3 -3
View File
@@ -96,12 +96,12 @@ export const FormContentsPage = (properties: TProperties) => {
const watchTags = watch('tags')
useEffect(() => {
if (fetcher.data?.success === false) {
toast.error(fetcher.data?.message)
if (!fetcher.data?.success && fetcher.data?.message) {
toast.error(fetcher.data.message)
return
}
if (fetcher.data?.success === true) {
if (fetcher.data?.success) {
toast.success(`Artikel berhasil ${newsData ? 'diupdate' : 'dibuat'}!`)
navigate('/lg-admin/contents')
return