isAuthenticated: isAuthenticated, // user authentication state
userRole: user.role, // user role
unAuthorizedStructure, // all the un-authentated routes goes here
authorizedStructure, // all the authentated routes goes here
anonymousStructure, // all the anonymous routes goes here
<Route path='/' element={<Navigate to={initialUrl} />} />
const authorizedStructure = {
fallbackPath: '/signin', // when user is not-autheticate then land here
unAuthorizedComponent: <Error403 />,// when user is autheticate but not authorized then land here
routes: [ // all authorized routed goes here
const unAuthorizedStructure = {
fallbackPath: initialUrl, // first route after login, you can change it as you want
const anonymousStructure = {
routes: errorPagesConfigs.concat([
element: <Navigate to='/error-pages/error-404' />,// setting 404 route