Skip to content

Commit 6531b86

Browse files
committed
fix: 리디렉션 오류 해결
/login url로 접속시 404 에러가 발생 - / 이하의 모든 라우트를 children으로 묶어 어떤 페이지로 접속하더라도 js파일을 받아올 수 있도록 함.
1 parent fec6ac3 commit 6531b86

File tree

1 file changed

+47
-41
lines changed

1 file changed

+47
-41
lines changed

src/main.tsx

Lines changed: 47 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -14,55 +14,61 @@ import UserInvite from './components/common/UserInvite.tsx';
1414
const router = createBrowserRouter([
1515
{
1616
path: '/',
17-
element: (
18-
<ProtectedRoute>
19-
<App />
20-
</ProtectedRoute>
21-
),
22-
},
23-
{
24-
path: '/login',
25-
element: <LoginPage />,
26-
},
27-
{
28-
path: '/join',
29-
element: <JoinPage />,
30-
},
31-
{
32-
path: '/editPw',
33-
element: <ResetPwPage />,
34-
},
35-
{
36-
path: '/change-password',
37-
element: <ChangePasswordPage />,
38-
},
39-
{
40-
path: '*',
41-
element: <NotFound />,
42-
},
43-
{
44-
path: '/test',
4517
children: [
4618
{
47-
path: 'inputForm',
48-
element: <TextInputForm />,
19+
index: true,
20+
element: (
21+
<ProtectedRoute>
22+
<App />
23+
</ProtectedRoute>
24+
),
4925
},
26+
5027
{
51-
path: 'UserInvite',
52-
element: <UserInvite />,
28+
path: '/login',
29+
element: <LoginPage />,
30+
},
31+
{
32+
path: '/join',
33+
element: <JoinPage />,
34+
},
35+
{
36+
path: '/editPw',
37+
element: <ResetPwPage />,
38+
},
39+
{
40+
path: '/change-password',
41+
element: <ChangePasswordPage />,
42+
},
43+
{
44+
path: '*',
45+
element: <NotFound />,
5346
},
54-
],
55-
},
56-
{
57-
path: '/policy',
58-
children: [
5947
{
60-
path: 'personalInfo',
61-
element: <Policy.PersonalInfoPage />,
48+
path: '/test',
49+
children: [
50+
{
51+
path: 'inputForm',
52+
element: <TextInputForm />,
53+
},
54+
{
55+
path: 'UserInvite',
56+
element: <UserInvite />,
57+
},
58+
],
6259
},
6360
{
64-
path: 'usecondition',
65-
element: <Policy.UseConditionPage />,
61+
path: '/policy',
62+
children: [
63+
{
64+
path: 'personalInfo',
65+
element: <Policy.PersonalInfoPage />,
66+
},
67+
{
68+
path: 'usecondition',
69+
element: <Policy.UseConditionPage />,
70+
},
71+
],
6672
},
6773
],
6874
},

0 commit comments

Comments
 (0)