Fix read status filter showing only “Unknown” with no results
This commit is contained in:
committed by
Aditya Chandel
parent
538854b397
commit
480eb92f7d
@@ -403,6 +403,19 @@ export class BookService {
|
||||
);
|
||||
}
|
||||
|
||||
updateBookReadStatus(id: number, status: ReadStatus): Observable<void> {
|
||||
return this.http.put<void>(`${this.url}/${id}/read-status`, {status}).pipe(
|
||||
tap(() => {
|
||||
const currentState = this.bookStateSubject.value;
|
||||
if (!currentState.books) return;
|
||||
const updatedBooks = currentState.books.map(book =>
|
||||
book.id === id ? {...book, readStatus: status} : book
|
||||
);
|
||||
this.bookStateSubject.next({...currentState, books: updatedBooks});
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/*------------------ All the websocket handlers go below ------------------*/
|
||||
|
||||
@@ -506,8 +519,4 @@ export class BookService {
|
||||
getBackupMetadata(bookId: number) {
|
||||
return this.http.get<any>(`${this.url}/${bookId}/metadata/restore`);
|
||||
}
|
||||
|
||||
updateBookReadStatus(id: number, status: ReadStatus): Observable<void> {
|
||||
return this.http.put<void>(`${this.url}/${id}/read-status`, {status});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user