move login back to using finally handler and update tests

This commit is contained in:
John Mitchell
2018-10-31 10:28:51 -04:00
parent 7c97989e84
commit 986d299961
2 changed files with 12 additions and 28 deletions

View File

@@ -50,14 +50,13 @@ class LoginPage extends Component {
this.safeSetState({ loading: true });
api.login(username, password)
.then(() => {
this.safeSetState({ loading: false });
})
.catch(error => {
this.safeSetState({ loading: false });
if (error.response.status === 401) {
this.safeSetState({ error: LOGIN_ERROR_MESSAGE });
}
})
.finally(() => {
this.safeSetState({ loading: false });
});
}
}