Enable editing existing admin users, creating new admins, and deleting other admin users

This commit is contained in:
adityachandelgit
2025-05-17 01:23:02 -06:00
committed by Aditya Chandel
parent 099eecbde5
commit 6a8561080f
12 changed files with 88 additions and 41 deletions
@@ -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) => {