관리자 기본 진입 경로 수정
This commit is contained in:
parent
778e8526d4
commit
bd046c4501
6 changed files with 62 additions and 25 deletions
|
|
@ -74,6 +74,14 @@ export function canAccessRole(user: AuthUser, role: Role): boolean {
|
|||
return role === "admin" && user.adminAccess;
|
||||
}
|
||||
|
||||
export function initialPathForUser(user: AuthUser): string {
|
||||
if (user.accountStatus !== "approved") return "/pending";
|
||||
if (user.onboardingCompletedAt == null) {
|
||||
return canAccessRole(user, "admin") ? "/admin" : "/onboarding";
|
||||
}
|
||||
return canAccessRole(user, "admin") ? "/admin" : roleHomePath(user.role);
|
||||
}
|
||||
|
||||
export function accessibleRolesFor(user: AuthUser): Role[] {
|
||||
if (user.superAdmin || user.role === "admin") return ["learner", "teacher", "admin"];
|
||||
if (user.adminAccess) return ["admin"];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue