Remove sort persistence
This commit is contained in:
@@ -113,24 +113,6 @@ export class LibraryService {
|
||||
);
|
||||
}
|
||||
|
||||
updateSort(libraryId: number, sort: SortOption): Observable<Library> {
|
||||
return this.http.put<Library>(`${this.url}/${libraryId}/sort`, sort).pipe(
|
||||
map(updatedLibrary => {
|
||||
const currentState = this.libraryStateSubject.value;
|
||||
const updatedLibraries = currentState.libraries?.map(library =>
|
||||
library.id === libraryId ? updatedLibrary : library
|
||||
) || [];
|
||||
this.libraryStateSubject.next({...currentState, libraries: updatedLibraries});
|
||||
return updatedLibrary;
|
||||
}),
|
||||
catchError(error => {
|
||||
const currentState = this.libraryStateSubject.value;
|
||||
this.libraryStateSubject.next({...currentState, error: error.message});
|
||||
throw error;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
getBookCount(libraryId: number): Observable<number> {
|
||||
return this.bookService.bookState$.pipe(
|
||||
map(state => (state.books || []).filter(book => book.libraryId === libraryId).length)
|
||||
|
||||
@@ -83,24 +83,6 @@ export class ShelfService {
|
||||
);
|
||||
}
|
||||
|
||||
updateSort(shelfId: number, sort: SortOption): Observable<Shelf> {
|
||||
return this.http.put<Shelf>(`${this.url}/${shelfId}/sort`, sort).pipe(
|
||||
map(updatedShelf => {
|
||||
const currentState = this.shelfStateSubject.value;
|
||||
const updatedShelves = currentState.shelves?.map(shelf =>
|
||||
shelf.id === shelfId ? updatedShelf : shelf
|
||||
) || [];
|
||||
this.shelfStateSubject.next({ ...currentState, shelves: updatedShelves });
|
||||
return updatedShelf;
|
||||
}),
|
||||
catchError(error => {
|
||||
const currentState = this.shelfStateSubject.value;
|
||||
this.shelfStateSubject.next({ ...currentState, error: error.message });
|
||||
throw error;
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
deleteShelf(shelfId: number): Observable<void> {
|
||||
return this.http.delete<void>(`${this.url}/${shelfId}`).pipe(
|
||||
tap(() => {
|
||||
|
||||
Reference in New Issue
Block a user