Skip to content

Commit

Permalink
fix: router separate
Browse files Browse the repository at this point in the history
  • Loading branch information
kcwww committed Dec 13, 2023
1 parent 82e0222 commit fc476e2
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion front/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ const App = () => {
</SnowBallProvider>
}
>
<Route path="" element={<Pages.Nickname />} />
<Route path="nickname" element={<Pages.Nickname />} />
<Route path="snowball" element={<Pages.Snowball />} />
</Route>

Expand Down
4 changes: 2 additions & 2 deletions front/src/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ const Main = () => {
setUserData(resUserData);

if (res.data.main_snowball === null) {
navigate('/make');
navigate('/make/snowball');
return;
}

Expand All @@ -114,7 +114,7 @@ const Main = () => {
userData.snowball_count === 0 ||
userData.nickname === 'null'
) {
navigate('/make');
navigate('/make/nickname');
}
}
})
Expand Down
4 changes: 2 additions & 2 deletions front/src/router/HasSnowballData.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 쿠키 값 전달
Expand All @@ -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
Expand Down

0 comments on commit fc476e2

Please sign in to comment.