fix: refresh admin self profile state
This commit is contained in:
@@ -125,11 +125,15 @@ export class Users {
|
||||
}
|
||||
|
||||
protected statusName(statusId?: number): string {
|
||||
return statusId === 2 ? 'Inaktiv' : 'Aktiv';
|
||||
if (statusId === 1) return 'Aktiv';
|
||||
if (statusId === 2) return 'Inaktiv';
|
||||
return 'Unbekannt';
|
||||
}
|
||||
|
||||
protected roleName(roleId?: number): string {
|
||||
return roleId === 1 ? 'Administrator' : 'Benutzer';
|
||||
if (roleId === 1) return 'Administrator';
|
||||
if (roleId === 2) return 'Benutzer';
|
||||
return 'Unbekannt';
|
||||
}
|
||||
|
||||
protected teamRoleName(name?: string): string {
|
||||
@@ -170,7 +174,17 @@ export class Users {
|
||||
let profileSaved = false;
|
||||
profileRequest
|
||||
.pipe(
|
||||
tap(() => (profileSaved = true)),
|
||||
tap((updatedUser) => {
|
||||
profileSaved = true;
|
||||
const currentUser = this.currentUser();
|
||||
if (currentUser?.id === updatedUser.id) {
|
||||
this.authStore.updateUser({
|
||||
...currentUser,
|
||||
firstName: updatedUser.firstName,
|
||||
lastName: updatedUser.lastName,
|
||||
});
|
||||
}
|
||||
}),
|
||||
switchMap(() =>
|
||||
roleId === value.role ? of(user) : this.adminUsersApi.updateRole(user.id, { role: value.role }),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user