hasRole("HQADMIN", props.userDetails) || hasAdminRight("MANAGE_CUSTOMERS", props.userDetails) || hasRole("CALL_CENTER", props.userDetails) || hasRole("REPORT_CALL_CENTER", props.userDetails) ?
<ListItem selected={location.pathname === '/admin/users'}
onClick={() => props.redirect('/admin/users')} button>
<ListItemIconExt>
<i className="fa fa-user-circle" />
</ListItemIconExt>
<ListItemText primary={<FormattedMessage id="sidebar.items.admin.users" defaultMessage="Users" />} />
</ListItem> : null}
{hasRole("MANAGE_USER_FORMS", props.userDetails) ?
<ListItem selected={location.pathname === '/admin/userforms'}
onClick={() => props.redirect('/admin/userforms')} button>
<ListItemIconExt>
<i className="fa fa-user-circle" />
</ListItemIconExt>
<ListItemText primary={<FormattedMessage id="sidebar.items.admin.userforms" defaultMessage="Manage User Forms" />} />
</ListItem>
: null}
Here is the router configurations for my app
<ConnectedRouter history={props.history}>
<Switch>
<Main>
<Switch>
<Route path="/dashboard" component={DashBoardPage}/>
<Route path="/reports" component={ReportsPage}/>
<Route path="/login" component={LoginPage}/>
<Route path="/p3/invoice" component={P3InvoicePage}/>
<Route path="/admin/rda" component={RdaPage}/>
<Route path="/admin/users" component={AdminUsersPage}/>
<Route path="/admin/notifications" component={AdminNotificationsPage}/>
<Route path="/admin/charities" component={AdminCharitiesPage}/>
<Route path="/admin/billers" component={AdminBillersPage}/>
<Route path="/admin/documents" component={DocumentsPage}/>
<Route path="/admin/branches" component={BranchesPage}/>
<Route path="/admin/banks" component={BanksPage}/>
<Route path="/admin/change_requests" component={ChangeRequestsPage}/>
<Route path="/admin/portal_users" component={UsersPage}/>
<Route path="/admin/globals" component={GlobalsPage}/>
<Route path="/admin/blacklist" component={Blacklist}/>
<Route path="/admin/userforms" component={AdminUserForm}/>
<Route path="*" component={NotFoundPage}/>
</Switch>
<div style={{position: "absolute", left: "30px", bottom: "30px", fontSize: "60px", opacity: "0.1", fontWeight: "900", userSelect: "none", pointerEvents: "none", zIndex: 100000}}>
{(env.NODE_ENV && env.NODE_ENV !== "prod") ? env.NODE_ENV.toUpperCase() : ""}<br/>
</div>
</Main>
</Switch>
</ConnectedRouter>
there are two things here the one with the above i call it when one of them condition is true and the below one i call when role is MANAGE_USER_FORMS but when i click on the Manage User Forms tab it redirects me to the login page why is this happening if it is because of adminRights then CALL_CENTER role also does not have a admin rights it’s null sem for MANAGE_USER_FORMS but the problem i seeing is it remove my auth-token from the sessionStorage that’s why it redirects me to the login page