From 9e3ad6bb63f104519ccd8cb6febbc7dc8e26fc06 Mon Sep 17 00:00:00 2001 From: cys4585 Date: Thu, 24 Oct 2024 20:07:38 +0900 Subject: [PATCH] =?UTF-8?q?fix:=EB=8B=A4=EB=9D=BD=EB=B0=A9=20=EC=B4=88?= =?UTF-8?q?=EB=8C=80=20=EC=BD=94=EB=93=9C=EB=A1=9C=20=EB=93=A4=EC=96=B4?= =?UTF-8?q?=EC=98=A4=EB=8A=94=20=EB=B6=84=EA=B8=B0=EC=B2=98=EB=A6=AC=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/App.tsx | 16 ++++++++-------- .../DarakbangSelectOptionPage.tsx | 9 +++++++++ .../pages/Navigator/DarakbangInvitationRoute.tsx | 2 ++ frontend/src/routes/router.tsx | 2 +- 4 files changed, 20 insertions(+), 9 deletions(-) diff --git a/frontend/src/App.tsx b/frontend/src/App.tsx index ea8ef9f76..3b96836a9 100644 --- a/frontend/src/App.tsx +++ b/frontend/src/App.tsx @@ -1,12 +1,12 @@ import { Global, ThemeProvider } from '@emotion/react'; -import { useEffect, useMemo } from 'react'; +import { useMemo } from 'react'; import BackgroundShadow from '@_components/BackgroundShadow/BackgroundShadow'; import { QueryClientProvider } from '@tanstack/react-query'; import { RouterProvider } from 'react-router-dom'; import createQueryClient from './queryClient'; import fonts from '@_common/font.style'; -import { removeInviteCode } from '@_common/inviteCodeManager'; +// import { removeInviteCode } from '@_common/inviteCodeManager'; import reset from './common/reset.style'; import router from '@_routes/router'; import { theme } from '@_common/theme/theme.style'; @@ -14,12 +14,12 @@ import { theme } from '@_common/theme/theme.style'; export default function App() { const queryClient = useMemo(createQueryClient, []); - useEffect(() => { - window.addEventListener('beforeunload', removeInviteCode); - return () => { - window.removeEventListener('beforeunload', removeInviteCode); - }; - }, []); + // useEffect(() => { + // window.addEventListener('beforeunload', removeInviteCode); + // return () => { + // window.removeEventListener('beforeunload', removeInviteCode); + // }; + // }, []); return ( <> diff --git a/frontend/src/pages/Darakbang/DarakbangSelectOptionPage/DarakbangSelectOptionPage.tsx b/frontend/src/pages/Darakbang/DarakbangSelectOptionPage/DarakbangSelectOptionPage.tsx index af761c2a7..998fb9980 100644 --- a/frontend/src/pages/Darakbang/DarakbangSelectOptionPage/DarakbangSelectOptionPage.tsx +++ b/frontend/src/pages/Darakbang/DarakbangSelectOptionPage/DarakbangSelectOptionPage.tsx @@ -4,10 +4,19 @@ import SelectLayout from '@_layouts/SelectLayout/SelectLayout'; import { useNavigate } from 'react-router-dom'; import { useTheme } from '@emotion/react'; import SelectBar from '../components/SelectBar/SelectBar'; +import { getInviteCode } from '@_common/inviteCodeManager'; +import { useEffect } from 'react'; export default function DarakbangSelectOptionPage() { const navigate = useNavigate(); const theme = useTheme(); + + useEffect(() => { + if (getInviteCode() !== null) { + navigate(ROUTES.darakbangInvitationRoute); + } + }, [navigate]); + return ( diff --git a/frontend/src/pages/Navigator/DarakbangInvitationRoute.tsx b/frontend/src/pages/Navigator/DarakbangInvitationRoute.tsx index a8965e0f7..4a14baf59 100644 --- a/frontend/src/pages/Navigator/DarakbangInvitationRoute.tsx +++ b/frontend/src/pages/Navigator/DarakbangInvitationRoute.tsx @@ -14,6 +14,8 @@ export default function DarakbangInvitationRoute() { const navigate = useNavigate(); const code = searchParam.get('code'); + if (code) setInviteCode(code); + const { darakbangName } = useDarakbangNameByCode(code || ''); const { myDarakbangs } = useMyDarakbangs(); const isRightCode = darakbangName && darakbangName !== ''; diff --git a/frontend/src/routes/router.tsx b/frontend/src/routes/router.tsx index 17cce04e9..a35fb36dd 100644 --- a/frontend/src/routes/router.tsx +++ b/frontend/src/routes/router.tsx @@ -175,7 +175,7 @@ const routesConfig = [ { path: ROUTES.darakbangInvitationRoute, element: , - requiresAuth: true, + requiresAuth: false, }, { path: ROUTES.darakbangLanding,