fix(auth): handle EMAIL_NOT_VERIFIED in onError callback

This commit is contained in:
waleed
2026-01-21 17:42:03 -08:00
parent 5987a6d060
commit 0c2868257c

View File

@@ -213,9 +213,12 @@ export default function LoginPage({
onError: (ctx) => {
logger.error('Login error:', ctx.error)
// EMAIL_NOT_VERIFIED is handled by the catch block which redirects to /verify
if (ctx.error.code?.includes('EMAIL_NOT_VERIFIED')) {
errorHandled = true
if (typeof window !== 'undefined') {
sessionStorage.setItem('verificationEmail', email)
}
router.push('/verify')
return
}