Skip to content

Commit

Permalink
feat(2fa): Close 2FA modal on failed resend
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley committed Mar 29, 2022
1 parent ad44534 commit 9735098
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import Modal from '../../common/modal/Modal';
import ModalTheme from '../ledger/ModalTheme';
import TwoFactorVerifyInput from './TwoFactorVerifyInput';

const TOO_MANY_REQUESTS_STATUS = 429;

const Form = styled.form`
display: flex;
flex-direction: column;
Expand Down Expand Up @@ -101,7 +103,12 @@ const TwoFactorVerifyModal = ({ open, onClose }) => {
setTimeout(() => { setResendCode(); }, 3000);
},
(e) => {
setResendCode();
if (e.status === TOO_MANY_REQUESTS_STATUS) {
onClose(false, e);
} else {
setResendCode();
}

throw e;
},
);
Expand Down

0 comments on commit 9735098

Please sign in to comment.