fix: update effect dependencies to use fetcher.data for improved error handling in dialogs

This commit is contained in:
Ardeman
2025-03-15 17:27:49 +08:00
parent e7ef7177ca
commit 7b840ce5cd
5 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -27,12 +27,12 @@ export const AdminLoginPage = () => {
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 (
<div className="flex min-h-dvh min-w-dvw flex-col items-center justify-center space-y-8">