Now showing unauthorized page when user is not authorized to access certain links

This commit is contained in:
Erik Tiekstra
2021-09-13 11:59:12 +02:00
parent 8be8fa84af
commit 4895ae3cb9
3 changed files with 3 additions and 1 deletions

View File

@@ -15,7 +15,7 @@ export class RoleGuard implements CanActivate {
const expectedRole: RoleEnum = route.data.expectedRole as RoleEnum;
return this.userService.userRoles$.pipe(
filter(roles => !!roles?.length),
filter(roles => !!roles),
map(roles => {
const userHasRole = roles.some(role => role.type === expectedRole);