Refactor: 라우터에 관리자 페이지 추가

This commit is contained in:
정현조 2024-09-09 17:30:09 +09:00
parent ab16706f89
commit 020c2f6739

View File

@ -3,13 +3,17 @@ import Home from '@/components/Home';
import WorkspaceBrowseDetail from '@/components/WorkspaceBrowseDetail';
import WorkspaceBrowseLayout from '@/components/WorkspaceBrowseLayout';
import WorkspaceLayout from '@/components/WorkspaceLayout';
import AdminLayout from '@/components/AdminLayout';
import ReviewList from '@/components/ReviewList';
import AdminMemberManage from '@/components/AdminMemberManage';
import { createBrowserRouter } from 'react-router-dom';
import { Navigate } from 'react-router-dom';
export const webPath = {
home: () => '/',
browse: () => '/browse',
workspace: () => '/workspace',
admin: (id: string) => `/admin/${id}`,
};
const router = createBrowserRouter([
@ -47,6 +51,24 @@ const router = createBrowserRouter([
},
],
},
{
path: webPath.admin(':id'),
element: <AdminLayout />,
children: [
{
index: true,
element: <Navigate to="review" />,
},
{
path: 'review',
element: <ReviewList />,
},
{
path: 'members',
element: <AdminMemberManage />,
},
],
},
]);
export default router;