Route Management
Route protection means, protecting any route from unauthorized access.
Create a new route
//Any user can access this menu
const routesConfig = [
...,
{
id: 'sample-page', // Id of the Menu
title: 'Sample Page', // Title of the Menu
messageId: 'sidebar.pages.samplePage', // Locale id of the Menu
type: 'item', // Type of menu of the Menu
icon: <ANY_SAMPLE_ICON/>, // Icon of the menu navigation
url: '/sample-page', // Path of the menu navigation
},
...
]
//The user has Staff level permission can access this menu
const routesConfig = [
...,
{
id: 'sample-page', // Id of the Menu
title: 'Sample Page', // Title of the Menu
messageId: 'sidebar.pages.samplePage', // Locale id of the Menu
type: 'item', // Type of menu of the Menu
permittedRole: RoutePermittedRole.Staff // Permitted user roles of the Menu
icon: <ANY_SAMPLE_ICON/>, // Icon of the menu navigation
url: '/sample-page', // Path of the menu navigation
},
...
]
///The user has Staff and Admin level permission can access this menu
const routesConfig = [
...,
{
id: 'sample-page', // Id of the Menu
title: 'Sample Page', // Title of the Menu
messageId: 'sidebar.pages.samplePage', // Locale id of the Menu
type: 'item', // Type of menu of the Menu
permittedRole: [ // Permitted user roles of the Menu
RoutePermittedRole.Staff, // This is an optional property
RoutePermittedRole.Admin
], //
icon: <ANY_SAMPLE_ICON/>, // Icon of the menu navigation
url: '/sample-page', // Path of the menu navigation
},
...
]Last updated