frontend: change isAdmin method to be asynchronous and await user roles

This commit is contained in:
juancarmore 2025-07-19 00:20:38 +02:00
parent 1a5c1c37ab
commit ebfb07607f

View File

@ -67,8 +67,9 @@ export class AuthService {
return this.user?.roles;
}
isAdmin(): boolean {
return this.user?.roles.includes(UserRole.ADMIN) || false;
async isAdmin(): Promise<boolean> {
const roles = await this.getUserRoles();
return roles ? roles.includes(UserRole.ADMIN) : false;
}
private async getAuthenticatedUser(force = false) {