Implement refresh library
This commit is contained in:
@@ -158,4 +158,17 @@ export class BookService {
|
||||
this.books.next(updatedBooks);
|
||||
}
|
||||
|
||||
handleRemovedBookIds(removedBookIds: Set<number>) {
|
||||
console.log(removedBookIds);
|
||||
|
||||
if (!(removedBookIds instanceof Set)) {
|
||||
console.error("removedBookIds should be a Set");
|
||||
return; // Or throw an error if preferred
|
||||
}
|
||||
|
||||
const currentBooks = this.books.getValue();
|
||||
let filteredBooks = currentBooks.filter(currentBook => !removedBookIds.has(currentBook.id));
|
||||
this.books.next(filteredBooks);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ export class LibraryService {
|
||||
);
|
||||
}
|
||||
|
||||
refreshLibrary(libraryId: number): Observable<void> {
|
||||
return this.http.put<void>(`${this.url}/${libraryId}/refresh`, {});
|
||||
}
|
||||
|
||||
updateSort(libraryId: number, sort: SortOption): Observable<Library> {
|
||||
return this.http.put<Library>(`${this.url}/${libraryId}/sort`, sort).pipe(
|
||||
map(updatedLibrary => {
|
||||
|
||||
Reference in New Issue
Block a user