Skip to content

Commit

Permalink
HotFix: 루트 페이지 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
JYN523 committed Nov 15, 2024
1 parent d3ba1ad commit 7a1884c
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/app/routes/path.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export const RouterPath = {
ROOT: '/',
ONBOARD: 'onboard',
LOGIN: 'login',
SIGNUP: 'signup',
REGISTER: 'register',
Expand Down
16 changes: 15 additions & 1 deletion src/app/routes/router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,12 @@ import { createBrowserRouter, RouterProvider } from 'react-router-dom';

import { ProtectedRoute } from './components';
import { RouterPath } from './path';
import { OnboardPage, RedirectPage, DummyRedirectPage } from '@/pages';
import {
OnboardPage,
RedirectPage,
DummyRedirectPage,
RootPage,
} from '@/pages';
import { Layout, LoadingView } from '@/shared/components';

export const RegisterPage = lazy(
Expand Down Expand Up @@ -128,6 +133,15 @@ export const router = createBrowserRouter([
children: [
{
path: '',
children: [
{
index: true,
element: <RootPage />,
},
],
},
{
path: RouterPath.ONBOARD,
children: [
{
index: true,
Expand Down
1 change: 1 addition & 0 deletions src/pages/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ export * from './onboard';
export * from './redirect';
export * from './register';
export * from './service-manual';
export * from './root';
2 changes: 0 additions & 2 deletions src/pages/common/onboard/ui/OnboardPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ export const OnboardPage = () => {
setPage(swiper.activeIndex);
};

if (window.location.pathname !== '/') return null;

return (
<MainPageLayout page={page}>
<Wrapper>
Expand Down
7 changes: 7 additions & 0 deletions src/pages/common/root/RootPage.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Navigate } from 'react-router-dom';

export const RootPage = () => {
if (window.location.pathname !== '/') return null;

return <Navigate to='/onboard' />;
};
1 change: 1 addition & 0 deletions src/pages/common/root/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { RootPage } from './RootPage';

0 comments on commit 7a1884c

Please sign in to comment.