Skip to content

Commit 23cd242

Browse files
committed
fix(auth): clear stale error state and disable navigation during resend
- Clear error at start of handleResend to remove stale messages - Clear error on resend success - Disable 'Use different email' button during resend loading - Disable 'Back to login' link during resend loading - Prevents navigation away during in-flight resend request
1 parent 558ca1a commit 23cd242

1 file changed

Lines changed: 8 additions & 2 deletions

File tree

frontend/src/components/auth/SignupForm.tsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,13 @@ export function SignupForm() {
2323
const navigate = useNavigate()
2424

2525
const handleResend = async () => {
26+
setError('')
2627
setResendLoading(true)
2728
setResendSuccess(false)
2829
try {
2930
await resendVerification(email)
3031
setResendSuccess(true)
32+
setError('')
3133
} catch (err: any) {
3234
setError(err.message || 'Failed to resend verification email')
3335
} finally {
@@ -199,7 +201,8 @@ export function SignupForm() {
199201
<span className="text-muted-foreground">·</span>
200202
<button
201203
onClick={handleGoBack}
202-
className="text-sm text-muted-foreground hover:text-foreground"
204+
disabled={resendLoading}
205+
className="text-sm text-muted-foreground hover:text-foreground disabled:opacity-50 disabled:cursor-not-allowed"
203206
>
204207
Use different email
205208
</button>
@@ -216,7 +219,10 @@ export function SignupForm() {
216219
>
217220
<Link
218221
to="/login"
219-
className="inline-flex items-center gap-2 text-sm text-muted-foreground hover:text-foreground transition-colors"
222+
className={`inline-flex items-center gap-2 text-sm text-muted-foreground transition-colors ${
223+
resendLoading ? 'opacity-50 pointer-events-none' : 'hover:text-foreground'
224+
}`}
225+
onClick={(e) => resendLoading && e.preventDefault()}
220226
>
221227
<ArrowLeft className="w-4 h-4" />
222228
Back to login

0 commit comments

Comments
 (0)