Skip to content

Commit

Permalink
update pr
Browse files Browse the repository at this point in the history
  • Loading branch information
AkshataKatwal16 committed Nov 21, 2024
1 parent 70ce8a4 commit cff8057
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/RouteGuard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,13 @@ const RouteGuard: React.FC<{ children: React.ReactNode }> = ({ children }) => {
router.push("/unauthorized");
}
}

if ((user.role === Role.ADMIN || user.role === Role.CENTRAL_ADMIN )&& (allowedPaths.includes(router.pathname) || isWorkspaceContent || isCoursePlannerContent)) {
if (router.pathname !== "/login" && router.pathname !== "/logout") {

router.push("/unauthorized");
}
}
}, [router.pathname]);

return <>{children}</>;
Expand Down

0 comments on commit cff8057

Please sign in to comment.