-
Notifications
You must be signed in to change notification settings - Fork 8
Route configuration
Auron Vila edited this page Jun 8, 2024
·
2 revisions
The app uses React Router for navigation.
/src/configs/routes.config/authRoute.tsx (file containing public routes)
The routes that will be specified in the authRoute.tsx will only be accessed by unAuthenticated users.
const authRoute: Routes = [
{
key: 'signIn',
path: `/sign-in`,
component: lazy(() => import('@/pages/auth/SignIn')),
authority: []
},
]
/src/configs/routes.config/routes.config.ts (file containing private routes)
The routes that will be specified in the routes.config.ts will only be accessed by authenticated users only.
const authRoute: Routes = [
{
key: 'dashboard',
path: '/dashboard',
component: lazy(() => import('@/pages/Dashboard')),
authority: []
},
]
key: is the specified route's key.
path: the path that is responsible for rendering the component.
component: the component that will get rendered when the user accesses the specified route.
authority: The roles that will have access to this route(if you leave it as a blank array it will be accessed by anyone).