Skip to content
This repository has been archived by the owner on Jul 29, 2024. It is now read-only.

Commit

Permalink
refactor: Router 구조 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
jeonjeunghoon committed Aug 15, 2023
1 parent 55939ce commit d9afabc
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 8 deletions.
4 changes: 2 additions & 2 deletions frontend/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
import { ErrorBoundary } from 'components/ErrorBoundary/ErrorBoundary';
import { ReactQueryDevtools } from '@tanstack/react-query-devtools';
import Layout from 'pages/Layout/Layout';
import { Outlet } from 'react-router-dom';

const queryClient = new QueryClient({
defaultOptions: {
Expand All @@ -16,7 +16,7 @@ const App = () => {
return (
<QueryClientProvider client={queryClient}>
<ErrorBoundary>
<Layout />
<Outlet />
</ErrorBoundary>
<ReactQueryDevtools initialIsOpen={false} />
</QueryClientProvider>
Expand Down
24 changes: 18 additions & 6 deletions frontend/src/routes/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import WritingPage from 'pages/WritingPage/WritingPage';
import WritingTablePage from 'pages/WritingTablePage/WritingTablePage';
import App from '../App';
import OauthPage from 'pages/OauthPage/OauthPage';
import IntroducePage from 'pages/IntroducePage/IntroducePage';
import Layout from 'pages/Layout/Layout';

export const Router = () => {
const browserRouter = createBrowserRouter([
Expand All @@ -11,12 +13,8 @@ export const Router = () => {
element: <App />,
children: [
{
path: '/writings/:categoryId/:writingId',
element: <WritingPage />,
},
{
path: '/writings/:categoryId',
element: <WritingTablePage />,
path: '',
element: <IntroducePage />,
},
{
path: '/oauth/login/*',
Expand All @@ -27,6 +25,20 @@ export const Router = () => {
},
],
},
{
path: '/space',
element: <Layout />,
children: [
{
path: 'writings/:categoryId/:writingId',
element: <WritingPage />,
},
{
path: 'writings/:categoryId',
element: <WritingTablePage />,
},
],
},
],
},
]);
Expand Down

0 comments on commit d9afabc

Please sign in to comment.