Fix error message on login.

This commit is contained in:
Mike Cao committed 2020-08-19 19:03:42 -07:00
1 parent c5d7d5dea2
commit b905824d50
3 files changed
+5 -3

No files matched your search

+2 -2
View File
@@ -32,10 +32,10 @@ export default function LoginForm() {
const handleSubmit = async ({ username, password }) => {
const response = await post('/api/auth/login', { username, password });
if (response?.token) {
if (typeof response !== 'string') {
await Router.push('/');
} else {
setMessage('Incorrect username/password');
setMessage(response.startsWith('401') ? 'Incorrect username/password' : response);
}
};