fix: update effect dependencies to use fetcher.data for improved error handling in dialogs
This commit is contained in:
@@ -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">
|
||||
|
||||
Reference in New Issue
Block a user