import { NavLink, Outlet } from 'react-router' import { useEffect } from 'react' import { currentUser, getAccessToken } from '../auth/keycloak' import { LEARNER_NAV_ITEMS, hasAnyRole, hasLearnerPortalAccess } from '../learner-portal' export function LearnerLayout() { const user = currentUser() const roles = user.roles ?? [] useEffect(() => { // Re-enter bootstrap auth flow when the token is missing. if (!getAccessToken()) { window.location.reload() } }, []) if (!hasLearnerPortalAccess(roles)) { return ( Learner Portal Access Restricted Your account is authenticated but does not currently have learner portal access. ) } return ( ) }
Your account is authenticated but does not currently have learner portal access.