Implement library update

This commit is contained in:
aditya.chandel
2025-01-19 02:56:25 -07:00
parent 6beae77c35
commit 67d1b75831
23 changed files with 261 additions and 124 deletions
@@ -182,10 +182,10 @@ export class BookService {
this.bookStateSubject.next({...currentState, books: updatedBooks});
}
handleRemovedBookIds(removedBookIds: Set<number>): void {
handleRemovedBookIds(removedBookIds: number[]): void {
const currentState = this.bookStateSubject.value;
const filteredBooks = (currentState.books || []).filter(book => !removedBookIds.has(book.id));
this.bookStateSubject.next({...currentState, books: filteredBooks});
const filteredBooks = (currentState.books || []).filter(book => !removedBookIds.includes(book.id)); // Check using includes() method
this.bookStateSubject.next({ ...currentState, books: filteredBooks });
}
handleBookUpdate(updatedBook: Book) {