This section explains how to set the Dashboard page as the default starting page, skipping the landing page, for cases where it is not needed.
Copy // import { lazy } from 'react';
import { useRoutes } from 'react-router-dom' ;
// project-imports
// import CommonLayout from 'layout/CommonLayout';
// import Loadable from 'components/Loadable';
import ComponentsRoutes from './ComponentsRoutes' ;
// import LoginRoutes from './LoginRoutes';
import MainRoutes from './MainRoutes' ;
// render - landing page
// const PagesLanding = Loadable(lazy(() => import('pages/landing')));
// ==============================|| ROUTING RENDER ||============================== //
const router = createBrowserRouter (
[
// {
// path: '/',
// element: <SimpleLayout layout={SimpleLayoutType.LANDING} />,
// children: [
// {
// index: true,
// element: <PagesLanding />
// }
// ]
// },
// LoginRoutes,
MainRoutes ,
ComponentsRoutes
] ,
{ basename : import . meta . env . VITE_APP_BASE_NAME }
);
export default router;
src\routes\MainRoutes.jsx
Copy ...
const MainRoutes = {
path : '/' ,
children : [
{
path : '/' ,
element : < DashboardLayout /> ,
children : [
{
path : '/' ,
element : < DashboardDefault />
}
]
} ,
{
path : '/' ,
element : < DashboardLayout /> ,
children : [
...
]
}
... .
src/layout/Dashboard/index.jsx
Copy // import AuthGuard from 'utils/route-guard/AuthGuard';
...
...
return (
// <AuthGuard>
< Box sx = {{ display : 'flex' , width : '100%' }}>
< Header />
...
</ Box >
// </AuthGuard>
)