Merge branch 'fix-login-error' into 'develop'

LoginPage: fix crash

See merge request soapbox-pub/soapbox-fe!981
This commit is contained in:
Alex Gleason 2022-01-11 17:21:25 +00:00
commit 783e194359
1 changed files with 3 additions and 2 deletions

View File

@ -52,8 +52,9 @@ class LoginPage extends ImmutablePureComponent {
dispatch(switchAccount(account.id)); dispatch(switchAccount(account.id));
} }
}).catch(error => { }).catch(error => {
if (error.response.data.error === 'mfa_required') { const data = error.response && error.response.data;
this.setState({ mfa_auth_needed: true, mfa_token: error.response.data.mfa_token }); if (data && data.error === 'mfa_required') {
this.setState({ mfa_auth_needed: true, mfa_token: data.mfa_token });
} }
this.setState({ isLoading: false }); this.setState({ isLoading: false });
}); });