Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
saa00123 committed Sep 5, 2023
1 parent 96f5084 commit 12dd912
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions front/src/components/frames/token/UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,15 @@ export const UserProvider: React.FC<{ children: React.ReactNode }> = ({
};

const token = fetchTokenFromCookie();
console.log("Token: ", token);
const storedNickname = localStorage.getItem("nickname");
console.log("Stored Nickname: ", storedNickname);

if (token) {
if (storedNickname) {
setUser({ token, nickname: storedNickname, isNewUser: false });
} else {
console.log("Redirecting to /ChangeNickname");
setUser({ token, nickname: "Guest", isNewUser: true });
navigate("/ChangeNickname");
}
Expand Down

0 comments on commit 12dd912

Please sign in to comment.