22 lines
819 B
TypeScript
22 lines
819 B
TypeScript
import { Navigate, Route, Routes, useLocation } from 'react-router-dom';
|
|
import Home from '~/driving/main/pages';
|
|
import { routes } from '~/driven/utils/configs/appConfig';
|
|
import CreateUser from '../pages/CreateUser';
|
|
import MainPageLayout from '../pages/layouts/MainPageLayout';
|
|
import AuthenticationPage from '../pages/Authentication';
|
|
|
|
export default function Router() {
|
|
const location = useLocation();
|
|
|
|
return (
|
|
<Routes location={location} key={location.key}>
|
|
<Route element={<MainPageLayout />}>
|
|
<Route index element={<Home />} />
|
|
<Route path={routes.createUser} element={<CreateUser />} />
|
|
</Route>
|
|
<Route path={routes.authentication} element={<AuthenticationPage />} />
|
|
<Route path='*' element={<Navigate to={routes.usersList} replace />} />
|
|
</Routes>
|
|
);
|
|
}
|