Skip to content

Commit

Permalink
hotfix: TokenRefresher 로직 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
pepperdad committed Dec 18, 2024
1 parent 14b64ab commit cffd4cd
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/hooks/useTokenRefresher.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,15 @@ export default function TokenRefresher() {

useEffect(() => {
const user = localStorage.getItem("user");
console.log(user);
console.log(JSON.parse(user)?.role);
console.log(JSON.parse(user)?.refreshToken);
console.log(!user || !JSON.parse(user)?.role || !JSON.parse(user)?.refreshToken);

if (!user || !JSON.parse(user)?.role || !JSON.parse(user)?.refreshToken) {
// 기존에 존재하던 유저 role, refreshToken 유무로 임시로 토큰 제거 후 리로드
localStorage.clear();
openAlert({ title: "다시 로그인 해주세요." });
// localStorage.clear();
// openAlert({ title: "다시 로그인 해주세요." });
// window.location.reload();
return;
}
Expand Down

0 comments on commit cffd4cd

Please sign in to comment.