From 8e1c9a7ee75af758d0f10d15e078ec0e58b849bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EC=88=98?= Date: Mon, 28 Aug 2023 19:08:19 +0900 Subject: [PATCH 1/2] =?UTF-8?q?Fix=20onlyNotuser=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layouts/onlyNotUser.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/layouts/onlyNotUser.tsx b/components/layouts/onlyNotUser.tsx index 1b8569e..822040e 100644 --- a/components/layouts/onlyNotUser.tsx +++ b/components/layouts/onlyNotUser.tsx @@ -8,9 +8,9 @@ export default function OnlyNotUser({ children }: { children: React.ReactNode }) const { showAlert } = useAlert(); const router = useRouter(); useEffect(() => { - if (user) { + if (!isError) { router.replace('/'); } - }, [user, showAlert, router]); + }, [isError, showAlert, router]); return children; } From aba6b183a8a0666a36ecb0ab4e27078849fdf892 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=EC=A7=80=EC=88=98?= Date: Thu, 21 Dec 2023 23:00:33 +0900 Subject: [PATCH 2/2] =?UTF-8?q?Refactor:=20Login/Join=20=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EC=97=90=EC=84=9C=20=EB=A1=9C=EA=B3=A0=EB=A7=8C=20?= =?UTF-8?q?=EB=B3=B4=EC=9D=B4=EA=B2=8C=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/layouts/header.tsx | 13 ++++++++++++- components/layouts/layout.tsx | 6 +++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/components/layouts/header.tsx b/components/layouts/header.tsx index 94326c1..62d9a91 100644 --- a/components/layouts/header.tsx +++ b/components/layouts/header.tsx @@ -13,7 +13,8 @@ import { deleteUser } from '@/apis/deleteUser'; import { iconMenuDisabledUrls } from '@/libs/iconMenuDisabledUrls'; import { authToken } from '@/class/authToken'; -function Header() { +// onlyLogo: 로고만 보여줄지 (로그인, 회원가입 페이지에서 사용) +function Header({ onlyLogo }: { onlyLogo?: boolean }) { const router = useRouter(); const queryClient = useQueryClient(); const { user, isError } = useUserQuery(); @@ -26,6 +27,7 @@ function Header() { // 아이콘 메뉴 활성화 여부 const isIconMenuAbled = !iconMenuDisabledUrls.includes(router.pathname); + // 로그아웃 function handleLogout() { // 도메인 연결 전까지는 refreshToken이 작동하지 않으므로 logout 요청 보내지 않고 새로고침만 @@ -112,6 +114,15 @@ function Header() { return () => document.body.removeEventListener('click', closeIconMenus); }); + if (onlyLogo) + return ( + + ); + return (