Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
[Feat]::로그아웃 구현 완료 close #56
Browse files Browse the repository at this point in the history
  • Loading branch information
qhahd78 committed Jan 2, 2022
1 parent eff74c9 commit 85567cf
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/Components/Common/Header2.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable no-alert */
/* eslint-disable no-unused-expressions */
/* eslint-disable no-unused-vars */
/* eslint-disable react-hooks/exhaustive-deps */
Expand Down Expand Up @@ -57,15 +58,13 @@ const Header2 = () => {
const [UserProfile, setUserProfile] = useRecoilState(UserInfo);
const navigate = useNavigate();
const logout = () => {
console.log('로그아웃');
alert('정말 로그아웃 하시겠어요?');
// 모든 유저 정보 삭제
setUser();
setUserProfile();
sessionStorage.removeItem('user');
window.sessionStorage.clear();
const a = sessionStorage.getItem('user');
console.log(a);
// 홈 화면으로 이동
navigate('/');
};
return (
Expand Down
2 changes: 1 addition & 1 deletion src/Router/PublicRouter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Navigate, Outlet } from 'react-router-dom';

const PublicRouter = () => {
const user = JSON.parse(sessionStorage.getItem('user'));
return !user ? <Navigate to="/" /> : <Outlet />;
return !user.UserData ? <Navigate to="/" /> : <Outlet />;
};

export default PublicRouter;

0 comments on commit 85567cf

Please sign in to comment.