Skip to content

Commit

Permalink
[Fix] 새로고침 시 로그인 유지관련 코드 수정
Browse files Browse the repository at this point in the history
- 새로고침 시 로그인 유지되는 부분에 있어서 서버와 통신하는 로직 누락되었기 때문에 해당 코드 삭제 (작업 편의상 임시방편으로 설정해놓은 코드로, 담당자에게 해당 상황 공유함)
- 새로고침 시 로그인 상태 해제 되며, 동시에 기존에 가지고있던 액세스 토큰 delete 처리함

Issues #94
  • Loading branch information
novice1993 committed Sep 13, 2023
1 parent 0a9341c commit 20fb2a9
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions client/src/page/MainPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,14 @@ const MainPage = () => {
const isLogin = useSelector((state: StateProps) => state.login);
const [isLoggedIn, setIsLoggedIn] = useState(false); // 로그인 상태 관리

// 🔴 새로고침 되면 로그인 해제되면서 액세스 토큰도 같이 삭제됨
useEffect(() => {
const authToken = localStorage.getItem("authToken");
// const authToken = localStorage.getItem("authToken");

if (authToken !== null) {
dispatch(setLoginState());
}
// if (authToken !== null) {
// dispatch(setLoginState());
// }
localStorage.removeItem("authToken");
}, []);

//프로필 모달 열고닫는 매커니즘
Expand Down

0 comments on commit 20fb2a9

Please sign in to comment.