Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,14 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
}
}, [t]);

useEffect(() => {
setupCompleteRef.current = setupComplete;
}, [setupComplete]);

useEffect(() => {
void fetchMfaSetup();

return () => {
if (!setupCompleteRef.current) {
void accountService.cancelMfaSetup();
accountService.cancelMfaSetup().catch(() => {
// No pending secret to clear once MFA is enabled; ignore the 409.
});
}
};
}, [fetchMfaSetup]);
Expand Down Expand Up @@ -113,6 +111,7 @@ function MFASetupContent({ onMfaSetupComplete }: MFASetupSlideProps) {
setSubmitting(true);
setMfaError("");
await accountService.enableMfa(mfaSetupCode.trim());
setupCompleteRef.current = true;
setSetupComplete(true);
onMfaSetupComplete?.();
} catch (err) {
Expand Down
Loading