Skip to content

Commit

Permalink
refactor : 라우터 호황 패키지 설치
Browse files Browse the repository at this point in the history
  • Loading branch information
omjinLTS committed Apr 30, 2024
1 parent 67cd074 commit b3ced58
Showing 1 changed file with 20 additions and 16 deletions.
36 changes: 20 additions & 16 deletions src/PageRouter.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { lazy, Suspense } from 'react';
import {
BrowserRouter as RootRouter,
Redirect,
Route,
BrowserRouter as RootRouter,
Switch as RootSwitch,
Route,
} from 'react-router-dom';
import { CompatRouter } from 'react-router-dom-v5-compat';

import { AuthRouter } from './AuthRouter';
import Loading from './components/Loading';
Expand All @@ -17,22 +18,25 @@ const HomePage = lazy(() => import('./pages/home/HomePage'));
export const PageRouter: React.FC = () => (
<Suspense fallback={<Loading />}>
<RootRouter>
<Route exact path="/">
<Redirect to={PAGE_URL.Home} />
</Route>
{/* TODO : remove after migration completed */}
<CompatRouter>
<Route exact path="/">
<Redirect to={PAGE_URL.Home} />
</Route>

<RootSwitch>
<Route path={PAGE_URL.Auth} component={Switch.AuthPage} />
<RootSwitch>
<Route path={PAGE_URL.Auth} component={Switch.AuthPage} />

<AuthRouter>
<Route path={PAGE_URL.Home} component={HomePage} />
<Route path={PAGE_URL.Locker} component={Switch.LockerPage} />
<Route path={PAGE_URL.Circle} component={Switch.CirclePage} />
<Route path={PAGE_URL.Board} component={Switch.BoardPage} />
<Route path={PAGE_URL.Setting} component={Switch.SettingPage} />
<Route path={PAGE_URL.History} component={Switch.HistoryPage} />
</AuthRouter>
</RootSwitch>
<AuthRouter>
<Route path={PAGE_URL.Home} component={HomePage} />
<Route path={PAGE_URL.Locker} component={Switch.LockerPage} />
<Route path={PAGE_URL.Circle} component={Switch.CirclePage} />
<Route path={PAGE_URL.Board} component={Switch.BoardPage} />
<Route path={PAGE_URL.Setting} component={Switch.SettingPage} />
<Route path={PAGE_URL.History} component={Switch.HistoryPage} />
</AuthRouter>
</RootSwitch>
</CompatRouter>
</RootRouter>
</Suspense>
);

0 comments on commit b3ced58

Please sign in to comment.