From 424b30bbd83adc071244112f902842ee2c94e709 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EB=B3=91=ED=98=84?= Date: Sat, 16 Sep 2023 02:13:03 +0900 Subject: [PATCH] =?UTF-8?q?[Fix]=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=9C=A0?= =?UTF-8?q?=EC=A7=80=EC=95=88=EB=90=98=EB=8A=94=20=EC=98=A4=EB=A5=98=20?= =?UTF-8?q?=ED=95=B4=EA=B2=B0=20=EC=9D=B4=EB=A9=94=EC=9D=BC=EB=A1=9C=20?= =?UTF-8?q?=EB=A1=9C=EA=B7=B8=EC=9D=B8=20=EC=8B=9C=20=EB=A1=9C=EC=BB=AC?= =?UTF-8?q?=EC=8A=A4=ED=86=A0=EB=A6=AC=EC=A7=80=EC=97=90=20=EC=A0=80?= =?UTF-8?q?=EC=9E=A5=EB=90=98=EB=8A=94=20=ED=86=A0=ED=81=B0=EC=9D=98=20?= =?UTF-8?q?=ED=82=A4=20=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD=20Issues=20?= =?UTF-8?q?#15?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/components/Logins/EmailLogin.tsx | 4 ++-- client/src/page/MainPage.tsx | 22 ++++++++++----------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/client/src/components/Logins/EmailLogin.tsx b/client/src/components/Logins/EmailLogin.tsx index 630a7ea3..3703a616 100644 --- a/client/src/components/Logins/EmailLogin.tsx +++ b/client/src/components/Logins/EmailLogin.tsx @@ -49,8 +49,8 @@ const EmailLoginModal: React.FC = ({ onClose, onLogin }) = dispatch(setLoginState()); // 토큰들을 로컬 스토리지에 저장 - if (authToken) localStorage.setItem("authToken", authToken); - if (refreshToken) localStorage.setItem("refreshToken", refreshToken); + if (authToken) localStorage.setItem("Authorization", authToken); + if (refreshToken) localStorage.setItem("Refresh-token", refreshToken); onLogin(); onClose(); diff --git a/client/src/page/MainPage.tsx b/client/src/page/MainPage.tsx index 565ac98c..af3bf85b 100644 --- a/client/src/page/MainPage.tsx +++ b/client/src/page/MainPage.tsx @@ -97,6 +97,7 @@ const MainPage = () => { const dispatch = useDispatch(); const isLogin = useSelector((state: RootState) => state.login); + console.log(isLogin); // 🔴 페이지 로드 시 로컬 스토리지의 토큰을 기반으로 로그인 상태를 확인합니다. useEffect(() => { @@ -119,18 +120,15 @@ const MainPage = () => { dispatch(setLoginState()); }; - // // 🔴 로그아웃 시 로컬스토리지에 있는 Auth 토큰 제거 - // const handleLogout = () => { - // dispatch(setLogoutState()); - // localStorage.removeItem("Authorization"); - // }; const handleLoginConfirmationClose = () => { setLoginConfirmationModalOpen(false); }; + // 현재 선택된 메뉴 타입을 상태로 관리 const [selectedMenu, setSelectedMenu] = useState<"전체종목" | "관심종목" | "보유종목">("전체종목"); + // 메뉴 변경 핸들러 const handleMenuChange = (menu: "전체종목" | "관심종목" | "보유종목") => { setSelectedMenu(menu); }; @@ -146,13 +144,13 @@ const MainPage = () => { {!expandScreen.left && ( - {selectedMenu === "전체종목" ? ( - - ) : selectedMenu === "보유종목" ? ( - - ) : ( - - )} + {selectedMenu === "전체종목" ? ( + + ) : selectedMenu === "관심종목" ? ( + + ) : selectedMenu === "보유종목" ? ( + + ) : null} )}