From fc476e2d4cddf27ba70d483bee7e5c2085cad471 Mon Sep 17 00:00:00 2001 From: kcwww Date: Wed, 13 Dec 2023 16:07:35 +0900 Subject: [PATCH] fix: router separate --- front/src/App.tsx | 2 +- front/src/pages/Main/Main.tsx | 4 ++-- front/src/router/HasSnowballData.tsx | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/front/src/App.tsx b/front/src/App.tsx index 9212302..6000b2e 100644 --- a/front/src/App.tsx +++ b/front/src/App.tsx @@ -70,7 +70,7 @@ const App = () => { } > - } /> + } /> } /> diff --git a/front/src/pages/Main/Main.tsx b/front/src/pages/Main/Main.tsx index f9848f3..28eef21 100644 --- a/front/src/pages/Main/Main.tsx +++ b/front/src/pages/Main/Main.tsx @@ -98,7 +98,7 @@ const Main = () => { setUserData(resUserData); if (res.data.main_snowball === null) { - navigate('/make'); + navigate('/make/snowball'); return; } @@ -114,7 +114,7 @@ const Main = () => { userData.snowball_count === 0 || userData.nickname === 'null' ) { - navigate('/make'); + navigate('/make/nickname'); } } }) diff --git a/front/src/router/HasSnowballData.tsx b/front/src/router/HasSnowballData.tsx index 8984bb7..dfaeb46 100644 --- a/front/src/router/HasSnowballData.tsx +++ b/front/src/router/HasSnowballData.tsx @@ -8,7 +8,7 @@ const HasSnowballData: React.FC<{ children: ReactNode }> = ({ children }) => { const maxSnowball = 5; useEffect(() => { - if (url === '' || url === '/make' || url === 'main') { + if (url === '' || url === '/make/nickname' || url === 'main') { axios .get('/api/user', { withCredentials: true // axios 쿠키 값 전달 @@ -17,7 +17,7 @@ const HasSnowballData: React.FC<{ children: ReactNode }> = ({ children }) => { if (res.status === 200) { const data = res.data; if (data.user.nickname === null) { - setUrl('/make'); + setUrl('/make/nickname'); } else if ( data.user.nickname !== null && data.main_snowball === null