frontend: change isAdmin method to be asynchronous and await user roles
This commit is contained in:
parent
1a5c1c37ab
commit
ebfb07607f
@ -67,8 +67,9 @@ export class AuthService {
|
|||||||
return this.user?.roles;
|
return this.user?.roles;
|
||||||
}
|
}
|
||||||
|
|
||||||
isAdmin(): boolean {
|
async isAdmin(): Promise<boolean> {
|
||||||
return this.user?.roles.includes(UserRole.ADMIN) || false;
|
const roles = await this.getUserRoles();
|
||||||
|
return roles ? roles.includes(UserRole.ADMIN) : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async getAuthenticatedUser(force = false) {
|
private async getAuthenticatedUser(force = false) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user