diff --git a/app/layouts/admin/dialog-upload.tsx b/app/layouts/admin/dialog-upload.tsx index 2c5604c..2a2fbec 100644 --- a/app/layouts/admin/dialog-upload.tsx +++ b/app/layouts/admin/dialog-upload.tsx @@ -37,7 +37,7 @@ export const DialogUpload = () => { setUploadedFile(fetcher.data.uploadData.data.file_url) // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fetcher]) + }, [fetcher.data]) const handleChange = async function (event: ChangeEvent) { event.preventDefault() diff --git a/app/layouts/news/dialog-login.tsx b/app/layouts/news/dialog-login.tsx index e904fe3..d85f0a9 100644 --- a/app/layouts/news/dialog-login.tsx +++ b/app/layouts/news/dialog-login.tsx @@ -36,8 +36,8 @@ export const DialogLogin = () => { const { handleSubmit } = formMethods useEffect(() => { - if (!fetcher.data?.success) { - toast.error(fetcher.data?.message) + if (!fetcher.data?.success && fetcher.data?.message) { + toast.error(fetcher.data.message) return } @@ -47,7 +47,7 @@ export const DialogLogin = () => { setIsSubscribeOpen(true) } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fetcher]) + }, [fetcher.data]) return ( { const { handleSubmit, control } = formMethods useEffect(() => { - if (!fetcher.data?.success) { - toast.error(fetcher.data?.message) + if (!fetcher.data?.success && fetcher.data?.message) { + toast.error(fetcher.data.message) return } setIsRegisterOpen(false) setIsSuccessOpen('register') // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fetcher]) + }, [fetcher.data]) return ( { const { handleSubmit } = formMethods useEffect(() => { - if (!fetcher.data?.success) { - toast.error(fetcher.data?.message) + if (!fetcher.data?.success && fetcher.data?.message) { + toast.error(fetcher.data.message) return } setIsSubscribeOpen(false) setIsSuccessOpen('payment') // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fetcher]) + }, [fetcher.data]) return ( { const { handleSubmit } = formMethods useEffect(() => { - if (!fetcher.data?.success) { - toast.error(fetcher.data?.message) + if (!fetcher.data?.success && fetcher.data?.message) { + toast.error(fetcher.data.message) return } // eslint-disable-next-line react-hooks/exhaustive-deps - }, [fetcher]) + }, [fetcher.data]) return (