Skip to content

Commit

Permalink
Prevent redundant API calls
Browse files Browse the repository at this point in the history
  • Loading branch information
MonilBhavsar committed Oct 19, 2023
1 parent 2084476 commit 439a3c4
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ function CodesStep({account = defaultAccount}) {
const {setStep} = useTwoFactorAuthContext();

useEffect(() => {
if (account.recoveryCodes) {
if (account.requiresTwoFactorAuth || account.recoveryCodes) {
return;
}
Session.toggleTwoFactorAuth(true);
}, [account.recoveryCodes]);
}, []);

Check warning on line 39 in src/pages/settings/Security/TwoFactorAuth/Steps/CodesStep.js

View workflow job for this annotation

GitHub Actions / lint

React Hook useEffect has missing dependencies: 'account.recoveryCodes' and 'account.requiresTwoFactorAuth'. Either include them or remove the dependency array

return (
<StepWrapper
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const TwoFactorAuthPropTypes = {
const defaultAccount = {
requiresTwoFactorAuth: false,
twoFactorAuthStep: '',
recoveryCodes: '',
};

export {TwoFactorAuthPropTypes, defaultAccount};

0 comments on commit 439a3c4

Please sign in to comment.