This section explains how to set the Login page as the default starting page, skipping the landing page, for cases where it is not needed.
import { lazy } from 'react';
import { createBrowserRouter } from 'react-router-dom';
// project import
import MainRoutes from './MainRoutes';
import LoginRoutes from './LoginRoutes';
import ComponentsRoutes from './ComponentsRoutes';
import { SimpleLayoutType } from 'config';
import SimpleLayout from 'layout/Simple';
import Loadable from 'components/Loadable';
// 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,
ComponentsRoutes,
MainRoutes
],
{ basename: import.meta.env.VITE_APP_BASE_NAME }
);
export default router;
2. Add default Login route: full-version\src\routes\LoginRoutes.jsx
src\routes\LoginRoutes.jsx
import { lazy } from 'react';
// project import
import AuthLayout from 'layout/Auth';
import Loadable from 'components/Loadable';
// render - login
const AuthLogin = Loadable(lazy(() => import('pages/auth/login')));
const AuthRegister = Loadable(lazy(() => import('pages/auth/register')));
const AuthForgotPassword = Loadable(lazy(() => import('pages/auth/forgot-password')));
const AuthCheckMail = Loadable(lazy(() => import('pages/auth/check-mail')));
const AuthResetPassword = Loadable(lazy(() => import('pages/auth/reset-password')));
const AuthCodeVerification = Loadable(lazy(() => import('pages/auth/code-verification')));
// ==============================|| AUTH ROUTING ||============================== //
const LoginRoutes = {
path: '/',
children: [
{
path: '/',
element: <AuthLayout />,
children: [
{
path: '/',
element: <AuthLogin />
},
{
path: 'login',
element: <AuthLogin />
},
{
path: 'register',
element: <AuthRegister />
},
{
path: 'forgot-password',
element: <AuthForgotPassword />
},
{
path: 'check-mail',
element: <AuthCheckMail />
},
{
path: 'reset-password',
element: <AuthResetPassword />
},
{
path: 'code-verification',
element: <AuthCodeVerification />
}
]
}
]
};
export default LoginRoutes;