Browse Source

better error messaging

feature/qrscanner
Nareshkumar Rao 3 years ago
parent
commit
e9d0c4f492
  1. 13
      src/screens/LoginScreen.js

13
src/screens/LoginScreen.js

@ -70,7 +70,18 @@ function Login() {
} }
}) })
.catch(err => { .catch(err => {
if(err.response){
if(err.response.status === 401){
dispatch(authLogout()); dispatch(authLogout());
toast({
title: 'Login Failed',
description: 'The wrong credentials were used.',
status: 'error',
duration: 9000,
isClosable: true,
});
}
}else{
toast({ toast({
title: 'An error occurred', title: 'An error occurred',
description: 'Sorry, an error occurred on our side.', description: 'Sorry, an error occurred on our side.',
@ -78,6 +89,8 @@ function Login() {
duration: 9000, duration: 9000,
isClosable: true, isClosable: true,
}); });
}
}); });
e.preventDefault(); e.preventDefault();

Loading…
Cancel
Save