diff --git a/src/app/_services/library.service.ts b/src/app/_services/library.service.ts
index ab68af45b..c81bb2abc 100644
--- a/src/app/_services/library.service.ts
+++ b/src/app/_services/library.service.ts
@@ -41,4 +41,8 @@ export class LibraryService {
return this.httpClient.post(this.baseUrl + 'library/create', model);
}
+ delete(libraryId: number) {
+ return this.httpClient.delete(this.baseUrl + 'library/delete?libraryId=' + libraryId, {});
+ }
+
}
diff --git a/src/app/admin/manage-library/manage-library.component.html b/src/app/admin/manage-library/manage-library.component.html
index 4b2505ce3..0dc4eb1ce 100644
--- a/src/app/admin/manage-library/manage-library.component.html
+++ b/src/app/admin/manage-library/manage-library.component.html
@@ -10,7 +10,7 @@
{{library.name | titlecase}}
-
+
@@ -23,6 +23,4 @@
-
-
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/src/app/admin/manage-library/manage-library.component.ts b/src/app/admin/manage-library/manage-library.component.ts
index 571620446..a7c17cd61 100644
--- a/src/app/admin/manage-library/manage-library.component.ts
+++ b/src/app/admin/manage-library/manage-library.component.ts
@@ -19,25 +19,31 @@ export class ManageLibraryComponent implements OnInit {
ngOnInit(): void {
+ this.getLibraries();
+
+ }
+
+ getLibraries() {
this.libraryService.getLibraries().subscribe(libraries => {
this.libraries = libraries;
});
-
}
addLibrary() {
const modalRef = this.modalService.open(LibraryEditorModalComponent);
- }
-
- addFolder(library: string) {
- const modalRef = this.modalService.open(DirectoryPickerComponent);
- modalRef.closed.subscribe((closeResult: DirectoryPickerResult) => {
- console.log('Closed Result', closeResult);
- if (closeResult.success) {
- console.log('Add folder path to Library');
+ modalRef.closed.subscribe(refresh => {
+ if (refresh) {
+ this.getLibraries();
}
});
+ }
+ deleteLibrary(library: Library) {
+ if (confirm('Are you sure you want to delete this library? You cannot undo this action.')) {
+ this.libraryService.delete(library.id).subscribe(() => {
+ this.getLibraries();
+ });
+ }
}
}