Skip to content

Commit

Permalink
feat(header.jsx): logout page
Browse files Browse the repository at this point in the history
  • Loading branch information
junglesub committed Aug 6, 2024
1 parent 1a78a08 commit f76f2c9
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions src/components/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ import kakaoLogo from "../assets/kakaologo.svg";
import { serverRootUrl } from "../constants";
import { pretendard, timesNewRoman } from "../styles/fonts";
import TheModal from "./TheModal";
import { useRecoilValue } from "recoil";
import { useRecoilValue, useResetRecoilState } from "recoil";
import { authJwtAtom } from "../recoil/auth/atoms";
import { useNavigate } from "react-router-dom";

function Header({ loggedIn = false, ...props }) {
const navigate = useNavigate();

const resetAuth = useResetRecoilState(authJwtAtom);

const [openModal, setOpenModal] = useState("initial");
const headerRef = useRef(null);

Expand Down Expand Up @@ -48,13 +50,23 @@ function Header({ loggedIn = false, ...props }) {
<HeaderMenus>
<HeaderMenuBtn>ABOUT US</HeaderMenuBtn>
{jwtValue ? (
<HeaderMenuBtn
onClick={() => {
navigate("/newuser");
}}
>
MYPAGE
</HeaderMenuBtn>
<>
<HeaderMenuBtn
onClick={() => {
navigate("/newuser");
}}
>
MYPAGE
</HeaderMenuBtn>
<HeaderMenuBtn
onClick={() => {
resetAuth();
// navigate("/newuser");
}}
>
LOGOUT
</HeaderMenuBtn>
</>
) : (
<HeaderMenuBtn
onClick={() => {
Expand Down

0 comments on commit f76f2c9

Please sign in to comment.