refactor: improve error handling in authentication forms

- Updated error message display in `ForgotPasswordForm`, `LoginForm`, `RegisterForm`, and `ResetPasswordForm` to use `ctx.error.message` instead of `ctx.error.statusText`, providing clearer feedback to users on authentication errors.
This commit is contained in:
javayhu 2025-03-17 09:28:15 +08:00
parent a7f7556a6d
commit 9e958a5f9d
4 changed files with 4 additions and 4 deletions

View File

@ -71,7 +71,7 @@ export const ForgotPasswordForm = ({ className }: { className?: string }) => {
},
onError: (ctx) => {
console.error('forgotPassword, error:', ctx.error);
setError(`${ctx.error.status} : ${ctx.error.statusText}`);
setError(`${ctx.error.status}: ${ctx.error.message}`);
},
}
);

View File

@ -74,7 +74,7 @@ export const LoginForm = ({ className }: { className?: string }) => {
},
onError: (ctx) => {
console.error('login, error:', ctx.error);
setError(`${ctx.error.status}:${ctx.error.statusText}`);
setError(`${ctx.error.status}: ${ctx.error.message}`);
},
}
);

View File

@ -75,7 +75,7 @@ export const RegisterForm = () => {
onError: (ctx) => {
// sign up fail, display the error message
console.error('register, error:', ctx.error);
setError(`${ctx.error.status}:${ctx.error.statusText}`);
setError(`${ctx.error.status}: ${ctx.error.message}`);
},
}
);

View File

@ -84,7 +84,7 @@ export const ResetPasswordForm = () => {
},
onError: (ctx) => {
console.error('resetPassword, error:', ctx.error);
setError(`${ctx.error.status}:${ctx.error.statusText}`);
setError(`${ctx.error.status}: ${ctx.error.message}`);
},
}
);