Commit 1723e27
committed
fix(account): prevent duplicate TOTP submission toast on success
Clear code input immediately after successful TOTP binding to prevent
the auto-submit useEffect from triggering a duplicate API call.
The issue occurred because:
1. User enters 6 digits, triggering handleSubmit via useEffect
2. API call succeeds, loading changes from true to false
3. handleSubmit (which depends on loading) gets recreated
4. useEffect triggers again since handleSubmit is a dependency
5. Second API call returns "TOTP is already in use" error toast
By clearing codeInput before navigation, the isCodeReady check fails
and prevents the duplicate submission.1 parent 3f71959 commit 1723e27
1 file changed
+4
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
147 | 151 | | |
148 | 152 | | |
149 | 153 | | |
| |||
0 commit comments