Compare commits

..

No commits in common. "81ce9eb546c36b871e8b28cb7c2b40a81099ccaa" and "7eb548e1384de3842db8a2fe09acdb3ebc20ff04" have entirely different histories.

2 changed files with 4 additions and 8 deletions

View File

@ -90,7 +90,7 @@ export function AuthProvider({ children }) {
});
if (resUser.status != 200) {
throw Error("Username or password is incorrect!");
throw Error("user does not have user data");
}
const userData = await resUser.json();
@ -104,7 +104,7 @@ export function AuthProvider({ children }) {
await storageUtil.setItem(TOKEN_KEY, loginData.data.jwt);
} catch (err) {
console.error("Failed to log in", err);
return { error: true, msg: err };
return { error: true, msg: err.res };
}
}

View File

@ -20,12 +20,8 @@ function LoginPage() {
}
}, [authState.authenticated]);
async function login() {
const res = await onLogin(email, pass);
if (res !== undefined && res.error === true) {
alert(res.msg);
return;
}
function login() {
onLogin(email, pass);
}
return (