Mantis MUI React
v3.5.0
v3.5.0
  • Documentation
  • Pre-requisites
  • Quick Start
  • Package
  • Folder Structure
  • State Management
  • Internationalization
  • Authentication
    • Switch to Auth0
    • Switch to Firebase
    • Switch to AWS Cognito
    • Switch to Supabase
  • Axios API Calls
  • Routing
  • Project Configuration
  • Color Presets
  • Theme/Style Configuration
  • How to
    • Login as First Page
    • Dashboard as First Page
    • Render Menu from the backend
    • Remove menu render from Backend
    • Remove Authentication
      • Vite
      • NextJS
  • Figma
  • Integration
    • Seed
    • To Existing Project
    • Comparison
  • Components
    • Avatar
    • BreadCrumb
    • Button
    • Dot
    • Main Card
    • Progress
    • SnackBar
    • Tooltip
    • Transitions
  • Dependencies
  • Roadmap
  • Support
  • Changelog
  • Mantis Eco System
  • FAQ
Powered by GitBook
On this page
  1. How to

Login as First Page

How to set login as First page instead landing

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.

  1. Update route at: full-version\src\routes\index.tsx

src\routes\index.tsx
// 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.tsx

src\routes\LoginRoutes.tsx
import { lazy } from 'react';

// project import
import AuthLayout from 'layout/Auth';
import Loadable from 'components/Loadable';
import { APP_AUTH, AuthProvider } from 'config';

// Jwt Auth
const JwtAuthLogin = Loadable(lazy(() => import('pages/auth/jwt/login')));
...

// Firebase Auth
const FirebaseAuthLogin = Loadable(lazy(() => import('pages/auth/firebase/login')));
...

// Auth0 Auth
const Auth0AuthLogin = Loadable(lazy(() => import('pages/auth/auth0/login')));
...

// Aws Auth
const AwsAuthLogin = Loadable(lazy(() => import('pages/auth/aws/login')));
...

// ==============================|| AUTH ROUTING ||============================== //

const LoginRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: <AuthLayout />,
      children: [
        {
          path: APP_AUTH === AuthProvider.JWT ? '/' : 'jwt',
          children: [
            {
              path: '/',
              element: <JwtAuthLogin />
            },
            {
              path: 'login',
              element: <JwtAuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.FIREBASE ? '/' : 'firebase',
          children: [
            {
              path: '/',
              element: <FirebaseAuthLogin />
            },
            {
              path: 'login',
              element: <FirebaseAuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.AUTH0 ? '/' : 'auth0',
          children: [
            {
              path: '/',
              element: <Auth0AuthLogin />
            },
            {
              path: 'login',
              element: <Auth0AuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.AWS ? '/' : 'aws',
          children: [
            {
              path: '/',
              element: <AwsAuthLogin />
            },
            {
              path: 'login',
              element: <AwsAuthLogin />
            },
            ...
          ]
        }
      ]
    }
  ]
};

export default LoginRoutes;

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.

  1. Update route at: full-version\src\routes\index.jsx

src\routes\index.jsx
// 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';
import { APP_AUTH, AuthProvider } from 'config';

// Jwt Auth
const JwtAuthLogin = Loadable(lazy(() => import('pages/auth/jwt/login')));
...

// Firebase Auth
const FirebaseAuthLogin = Loadable(lazy(() => import('pages/auth/firebase/login')));
...

// Auth0 Auth
const Auth0AuthLogin = Loadable(lazy(() => import('pages/auth/auth0/login')));
...

// Aws Auth
const AwsAuthLogin = Loadable(lazy(() => import('pages/auth/aws/login')));
...

// ==============================|| AUTH ROUTING ||============================== //

const LoginRoutes = {
  path: '/',
  children: [
    {
      path: '/',
      element: <AuthLayout />,
      children: [
        {
          path: APP_AUTH === AuthProvider.JWT ? '/' : 'jwt',
          children: [
            {
              path: '/',
              element: <JwtAuthLogin />
            },
            {
              path: 'login',
              element: <JwtAuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.FIREBASE ? '/' : 'firebase',
          children: [
            {
              path: '/',
              element: <FirebaseAuthLogin />
            },
            {
              path: 'login',
              element: <FirebaseAuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.AUTH0 ? '/' : 'auth0',
          children: [
            {
              path: '/',
              element: <Auth0AuthLogin />
            },
            {
              path: 'login',
              element: <Auth0AuthLogin />
            },
            ...
          ]
        },
        {
          path: APP_AUTH === AuthProvider.AWS ? '/' : 'aws',
          children: [
            {
              path: '/',
              element: <AwsAuthLogin />
            },
            {
              path: 'login',
              element: <AwsAuthLogin />
            },
            ...
          ]
        }
      ]
    }
  ]
};

export default LoginRoutes;

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.

  1. Update Route start: src/app/page.tsx

src/app/page.tsx
// project imports
// import SimpleLayout from 'layout/SimpleLayout';
import GuestGuard from 'utils/route-guard/GuestGuard';
import Login from 'views/auth/login';
// import Landing from 'views/landing';

export default function HomePage() {
  return (
    // <SimpleLayout>
    <GuestGuard>
      <Login />
    </GuestGuard>
    // </SimpleLayout>
  );
}

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.

  1. Update Route start: src/app/page.jsx

src/app/page.jsx
// project imports
// import SimpleLayout from 'layout/SimpleLayout';
import GuestGuard from 'utils/route-guard/GuestGuard';
import Login from 'views/auth/login';
// import Landing from 'views/landing';

export default function HomePage() {
  return (
    // <SimpleLayout>
    <GuestGuard>
      <Login />
    </GuestGuard>
    // </SimpleLayout>
  );
}
PreviousHow toNextDashboard as First Page