Add notification and handler for metadata update
This commit is contained in:
@@ -205,4 +205,12 @@ export class BookService {
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
handleUpdateMetadata(updatedBook: Book) {
|
||||
const currentState = this.bookStateSubject.value;
|
||||
const updatedBooks = (currentState.books || []).map(book => {
|
||||
return book.id == updatedBook.id ? {...book, metadata: updatedBook.metadata} : book
|
||||
});
|
||||
this.bookStateSubject.next({...currentState, books: updatedBooks})
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user