Skip to content

Commit

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

const token = fetchTokenFromCookie();
const storedNickname = localStorage.getItem("nickname");

if (token) {
const storedNickname = localStorage.getItem("nickname");
const isNewUser = localStorage.getItem("isNewUser") === "true";

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

0 comments on commit 3ae4200

Please sign in to comment.