From 7dab40ee87ca05e5faa5a34fa8e071a3b0cf7b42 Mon Sep 17 00:00:00 2001 From: Yoonyesol <51500821+Yoonyesol@users.noreply.github.com> Date: Sat, 19 Oct 2024 15:23:02 +0900 Subject: [PATCH] =?UTF-8?q?Fix:=20#222=20=EC=9D=B8=EC=A6=9D=EC=97=AC?= =?UTF-8?q?=EB=B6=80=EC=97=90=20=EB=94=B0=EB=9D=BC=20=ED=97=A4=EB=8D=94?= =?UTF-8?q?=EC=9D=98=20=EB=AC=B8=EA=B5=AC=EC=99=80=20=EB=A1=9C=EA=B7=B8?= =?UTF-8?q?=EC=95=84=EC=9B=83=20=EB=B2=84=ED=8A=BC=20=EB=85=B8=EC=B6=9C?= =?UTF-8?q?=ED=95=98=EB=8F=84=EB=A1=9D=20=EC=88=98=EC=A0=95=20(#223)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Fix: #222 인증여부에 따라 헤더의 문구와 로그아웃 버튼 노출하도록 수정 * Feat: #222 유저인증 되어 있지 않을 시 로그인 버튼 추가 * Chore: #222 로그인 화면 이동 시 replace 제거 --- src/components/common/Header.tsx | 10 ++++++---- src/mocks/services/authServiceHandler.ts | 9 +-------- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/src/components/common/Header.tsx b/src/components/common/Header.tsx index 441d34c7..63782aee 100644 --- a/src/components/common/Header.tsx +++ b/src/components/common/Header.tsx @@ -7,7 +7,7 @@ import { logout } from '@services/authService'; import useToast from '@hooks/useToast'; export default function Header() { - const { userInfo: userInfoData, onLogout, clearUserInfo } = useStore(); + const { userInfo: userInfoData, onLogout, clearUserInfo, isAuthenticated } = useStore(); const navigate = useNavigate(); const { toastSuccess } = useToast(); @@ -33,7 +33,9 @@ export default function Header() { diff --git a/src/mocks/services/authServiceHandler.ts b/src/mocks/services/authServiceHandler.ts index eba1bea5..73f10265 100644 --- a/src/mocks/services/authServiceHandler.ts +++ b/src/mocks/services/authServiceHandler.ts @@ -278,16 +278,9 @@ const authServiceHandler = [ // 로그아웃 API http.post(`${BASE_URL}/user/logout`, async ({ cookies }) => { - const { refreshToken, refreshTokenExpiresAt } = cookies; + const { refreshToken } = cookies; const currentTime = Date.now(); - if (!refreshToken || !refreshTokenExpiresAt) { - return HttpResponse.json( - { message: '리프레시 토큰이 유효하지 않습니다. 다시 로그인해 주세요.' }, - { status: 401 }, - ); - } - return new HttpResponse(null, { status: 200, headers: {