From 8249678488403cebc2fec756df5327af0a620a94 Mon Sep 17 00:00:00 2001 From: Peter KW Date: Mon, 18 Mar 2024 00:42:05 +0100 Subject: [PATCH] Using local storage for token --- frontend/src/Components/LoginCheck.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/Components/LoginCheck.tsx b/frontend/src/Components/LoginCheck.tsx index 6a8a028..786a96c 100644 --- a/frontend/src/Components/LoginCheck.tsx +++ b/frontend/src/Components/LoginCheck.tsx @@ -15,12 +15,16 @@ function LoginCheck(props: { username: props.username, password: props.password, }; + + localStorage.clear(); + api .login(user) .then((response: APIResponse) => { 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) => {