Skip to content

Commit 7a1884c

Browse files
committed
HotFix: 루트 페이지 추가
1 parent d3ba1ad commit 7a1884c

File tree

6 files changed

+25
-3
lines changed

6 files changed

+25
-3
lines changed

src/app/routes/path.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export const RouterPath = {
22
ROOT: '/',
3+
ONBOARD: 'onboard',
34
LOGIN: 'login',
45
SIGNUP: 'signup',
56
REGISTER: 'register',

src/app/routes/router.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom';
33

44
import { ProtectedRoute } from './components';
55
import { RouterPath } from './path';
6-
import { OnboardPage, RedirectPage, DummyRedirectPage } from '@/pages';
6+
import {
7+
OnboardPage,
8+
RedirectPage,
9+
DummyRedirectPage,
10+
RootPage,
11+
} from '@/pages';
712
import { Layout, LoadingView } from '@/shared/components';
813

914
export const RegisterPage = lazy(
@@ -128,6 +133,15 @@ export const router = createBrowserRouter([
128133
children: [
129134
{
130135
path: '',
136+
children: [
137+
{
138+
index: true,
139+
element: <RootPage />,
140+
},
141+
],
142+
},
143+
{
144+
path: RouterPath.ONBOARD,
131145
children: [
132146
{
133147
index: true,

src/pages/common/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ export * from './onboard';
33
export * from './redirect';
44
export * from './register';
55
export * from './service-manual';
6+
export * from './root';

src/pages/common/onboard/ui/OnboardPage.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ export const OnboardPage = () => {
1717
setPage(swiper.activeIndex);
1818
};
1919

20-
if (window.location.pathname !== '/') return null;
21-
2220
return (
2321
<MainPageLayout page={page}>
2422
<Wrapper>

src/pages/common/root/RootPage.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Navigate } from 'react-router-dom';
2+
3+
export const RootPage = () => {
4+
if (window.location.pathname !== '/') return null;
5+
6+
return <Navigate to='/onboard' />;
7+
};

src/pages/common/root/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export { RootPage } from './RootPage';

0 commit comments

Comments
 (0)