fix: clear auth form errors
- Clear error state before submitting credentials in login page - Clear error state before submitting registration in register page - Add optional onFieldChange callback to AuthForm to clear parent errors when fields change - Add role="alert" to error paragraph for accessibility Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.7
parent
84fb808b53
commit
fd6f60f4f4
@@ -30,7 +30,11 @@ export function LoginPage() {
|
||||
isSubmitting={mutation.isPending}
|
||||
error={error}
|
||||
googleOAuthEnabled={Boolean(meQuery.data?.features.googleOAuthEnabled)}
|
||||
onSubmit={async ({ email, password }) => mutation.mutateAsync({ email, password })}
|
||||
onSubmit={async ({ email, password }) => {
|
||||
setError(null);
|
||||
return mutation.mutateAsync({ email, password });
|
||||
}}
|
||||
onFieldChange={() => setError(null)}
|
||||
/>
|
||||
<p className="text-center text-sm text-muted-foreground">
|
||||
Belum punya akun? <Link className="text-primary" to="/register">Daftar</Link>
|
||||
|
||||
@@ -30,7 +30,11 @@ export function RegisterPage() {
|
||||
isSubmitting={mutation.isPending}
|
||||
error={error}
|
||||
googleOAuthEnabled={Boolean(meQuery.data?.features.googleOAuthEnabled)}
|
||||
onSubmit={async ({ name, email, password }) => mutation.mutateAsync({ name: name ?? '', email, password })}
|
||||
onSubmit={async ({ name, email, password }) => {
|
||||
setError(null);
|
||||
return mutation.mutateAsync({ name: name ?? '', email, password });
|
||||
}}
|
||||
onFieldChange={() => setError(null)}
|
||||
/>
|
||||
<p className="text-center text-sm text-muted-foreground">
|
||||
Sudah punya akun? <Link className="text-primary" to="/login">Masuk</Link>
|
||||
|
||||
Reference in New Issue
Block a user