More robust error handling

This commit is contained in:
oitsjustjose 2020-12-29 11:22:19 -06:00
commit 88277d2d3f
2 changed files with 13 additions and 6 deletions

View file

@ -27,7 +27,11 @@ const LoginComponent = ({
const submit = (evt) => {
evt.preventDefault();
postLogin(state).catch((ex) => {
postLogin(state).then((resp) => {
if (resp.status !== 200) {
setError(`${resp.data}`);
}
}).catch((ex) => {
setError(`${ex.response.data}`);
});
};