fix: streamline error handling in dialogs by removing unnecessary return statements

This commit is contained in:
Ardeman
2025-03-15 17:33:21 +08:00
parent 7b840ce5cd
commit d767055bdb
12 changed files with 14 additions and 24 deletions
+4 -3
View File
@@ -60,11 +60,12 @@ export const DialogRegister = () => {
useEffect(() => {
if (!fetcher.data?.success && fetcher.data?.message) {
toast.error(fetcher.data.message)
return
}
setIsRegisterOpen(false)
setIsSuccessOpen('register')
if (fetcher.data?.success) {
setIsRegisterOpen(false)
setIsSuccessOpen('register')
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [fetcher.data])