Using local storage for token
This commit is contained in:
parent
24e7e68ea0
commit
8249678488
1 changed files with 4 additions and 0 deletions
|
@ -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) => {
|
||||
|
|
Loading…
Reference in a new issue