First Commit
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { lazy } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
// @project
|
||||
import Loadable from '@/components/Loadable';
|
||||
import AdminLayout from '@/layouts/AdminLayout';
|
||||
|
||||
// Dashboard
|
||||
const AnalyticsPage = Loadable(lazy(() => import('@/views/admin/dashboard')));
|
||||
|
||||
// Utils
|
||||
const ColorPage = Loadable(lazy(() => import('@/views/components/utils/colors')));
|
||||
const ShadowPage = Loadable(lazy(() => import('@/views/components/utils/shadow')));
|
||||
const TypographyPage = Loadable(lazy(() => import('@/views/components/utils/typography')));
|
||||
|
||||
// Sample Page
|
||||
const SamplePage = Loadable(lazy(() => import('@/views/admin/sample-page')));
|
||||
|
||||
const MainRoutes = {
|
||||
path: '/',
|
||||
element: <AdminLayout />,
|
||||
children: [
|
||||
{ index: true, element: <Navigate to="/dashboard" replace /> },
|
||||
|
||||
{ path: 'dashboard', element: <AnalyticsPage /> },
|
||||
{
|
||||
path: 'utils',
|
||||
children: [
|
||||
{ path: 'color', element: <ColorPage /> },
|
||||
{ path: 'shadow', element: <ShadowPage /> },
|
||||
{ path: 'typography', element: <TypographyPage /> }
|
||||
]
|
||||
},
|
||||
{ path: 'sample-page', element: <SamplePage /> }
|
||||
]
|
||||
};
|
||||
|
||||
export default MainRoutes;
|
||||
@@ -0,0 +1,24 @@
|
||||
import { lazy } from 'react';
|
||||
import { Navigate } from 'react-router-dom';
|
||||
|
||||
// @project
|
||||
import Loadable from '@/components/Loadable';
|
||||
import AuthLayout from '@/layouts/AuthLayout';
|
||||
|
||||
// auth
|
||||
const LoginPage = Loadable(lazy(() => import('@/views/auth/login')));
|
||||
const RegisterPage = Loadable(lazy(() => import('@/views/auth/register')));
|
||||
|
||||
/*************************** PAGES ROUTES ***************************/
|
||||
|
||||
const PagesRoutes = {
|
||||
path: 'auth',
|
||||
element: <AuthLayout />,
|
||||
children: [
|
||||
{ index: true, element: <Navigate to="login" replace /> },
|
||||
{ path: 'login', element: <LoginPage /> },
|
||||
{ path: 'register', element: <RegisterPage /> }
|
||||
]
|
||||
};
|
||||
|
||||
export default PagesRoutes;
|
||||
@@ -0,0 +1,13 @@
|
||||
import { createBrowserRouter } from 'react-router-dom';
|
||||
|
||||
// @routes
|
||||
import MainRoutes from './MainRoutes';
|
||||
import PagesRoutes from './PagesRoutes';
|
||||
|
||||
/*************************** ROUTING RENDER ***************************/
|
||||
|
||||
const router = createBrowserRouter([PagesRoutes, MainRoutes], {
|
||||
basename: import.meta.env.VITE_APP_BASE_URL
|
||||
});
|
||||
|
||||
export default router;
|
||||
Reference in New Issue
Block a user