Enable editing existing admin users, creating new admins, and deleting other admin users
This commit is contained in:
committed by
Aditya Chandel
parent
099eecbde5
commit
6a8561080f
@@ -40,6 +40,7 @@ export class UserManagementComponent implements OnInit {
|
||||
private messageService = inject(MessageService);
|
||||
|
||||
users: User[] = [];
|
||||
currentUser: User | undefined;
|
||||
editingLibraryIds: number[] = [];
|
||||
allLibraries: Library[] = [];
|
||||
|
||||
@@ -51,6 +52,7 @@ export class UserManagementComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.loadUsers();
|
||||
this.loadMyself();
|
||||
this.libraryService.getAllLibrariesFromAPI().subscribe({
|
||||
next: (libraries) => {
|
||||
this.allLibraries = libraries;
|
||||
@@ -65,6 +67,21 @@ export class UserManagementComponent implements OnInit {
|
||||
});
|
||||
}
|
||||
|
||||
loadMyself() {
|
||||
this.userService.getMyself().subscribe({
|
||||
next: (user) => {
|
||||
this.currentUser = user;
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({
|
||||
severity: 'error',
|
||||
summary: 'Error',
|
||||
detail: 'Failed to fetch current user',
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
loadUsers() {
|
||||
this.userService.getUsers().subscribe({
|
||||
next: (data) => {
|
||||
|
||||
Reference in New Issue
Block a user