Icon support for library and shelf

This commit is contained in:
aditya.chandel
2024-12-26 16:55:11 -07:00
parent 6e8d978d6e
commit aba11ecaa8
28 changed files with 205 additions and 84 deletions
@@ -25,8 +25,8 @@ export class ShelfService {
});
}
createShelf(name: string): Observable<Shelf> {
return this.http.post<Shelf>(this.url, {name}).pipe(
createShelf(shelf: Shelf): Observable<Shelf> {
return this.http.post<Shelf>(this.url, shelf).pipe(
map(newShelf => {
this.shelves.next([...this.shelves.value, newShelf])
return newShelf;
@@ -56,14 +56,14 @@ export class ShelfService {
deleteShelf(shelfId: number) {
return this.http.delete<void>(`${this.url}/${shelfId}`).pipe(
tap(() => {
this.bookService.removeBooksByLibraryId(shelfId);
let shelves = this.shelves.value.filter(shelf => shelf.id !== shelfId);
this.shelves.next(shelves);
}),
catchError(error => {
return of();
})
tap(() => {
this.bookService.removeBooksByLibraryId(shelfId);
let shelves = this.shelves.value.filter(shelf => shelf.id !== shelfId);
this.shelves.next(shelves);
}),
catchError(error => {
return of();
})
);
}
}