mirror of
https://github.com/Tria-plc/emaui.git
synced 2026-08-29 17:38:14 +00:00
50 lines
1.6 KiB
TypeScript
50 lines
1.6 KiB
TypeScript
import {
|
|
createBrowserRouter,
|
|
RouterProvider,
|
|
Navigate,
|
|
} from 'react-router-dom';
|
|
import {
|
|
LoginPage,
|
|
ForgotPasswordPage,
|
|
OTPVerificationPage,
|
|
} from '@ema-platform/auth';
|
|
import { AuthLayout } from '../layouts/AuthLayout';
|
|
import { BackofficeLayout } from '../layouts/BackofficeLayout';
|
|
import { ProtectedRoute } from './ProtectedRoute';
|
|
import { DashboardPage } from '../features/dashboard/pages/DashboardPage';
|
|
import UserManagementHostPage from '../features/user-management-host/UserManagementHostPage';
|
|
import { ProfilePage } from '../features/profile/pages/ProfilePage';
|
|
import { ConfigurationPage } from '../features/configuration/pages/ConfigurationPage';
|
|
|
|
const router = createBrowserRouter([
|
|
{
|
|
element: <AuthLayout />,
|
|
children: [
|
|
{ path: '/login', element: <LoginPage /> },
|
|
{ path: '/forgot-password', element: <ForgotPasswordPage /> },
|
|
{ path: '/otp-verify', element: <OTPVerificationPage /> },
|
|
],
|
|
},
|
|
{ path: '/um/*', element: <UserManagementHostPage /> },
|
|
{
|
|
element: <ProtectedRoute />,
|
|
children: [
|
|
{
|
|
element: <BackofficeLayout />,
|
|
children: [
|
|
{ index: true, element: <Navigate to="/dashboard" replace /> },
|
|
{ path: 'dashboard', element: <DashboardPage /> },
|
|
{ path: 'profile', element: <ProfilePage /> },
|
|
{ path: 'configuration', element: <ConfigurationPage /> },
|
|
],
|
|
},
|
|
],
|
|
},
|
|
{ path: '/404', element: <div>Page not found</div> },
|
|
{ path: '*', element: <Navigate to="/404" replace /> },
|
|
]);
|
|
|
|
export function AppRouter() {
|
|
return <RouterProvider router={router} />;
|
|
}
|