Using local storage for token

This commit is contained in:
Peter KW 2024-03-18 00:42:05 +01:00
parent 24e7e68ea0
commit 8249678488

View file

@ -15,12 +15,16 @@ function LoginCheck(props: {
username: props.username,
password: props.password,
};
localStorage.clear();
api
.login(user)
.then((response: APIResponse<string>) => {
if (response.success) {
if (response.data !== undefined) {
const token = response.data;
localStorage.setItem("accessToken", token);
//TODO: change so that it checks for user type (admin, user, pm) instead
if (token !== "" && props.username === "admin") {
props.setAuthority((prevAuth) => {