diff --git a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts index 8a869edf9..4cc09d4fa 100644 --- a/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts +++ b/booklore-ui/src/app/book/components/book-browser/book-browser.component.ts @@ -367,11 +367,6 @@ export class BookBrowserComponent implements OnInit, AfterViewInit { switchMap(({entityId, entityType}) => this.fetchBooksByEntity(entityId, entityType)) ); } - if (this.entityType === EntityType.LIBRARY) { - this.libraryService.updateSort(this.entity?.id!, sortOption).subscribe(); - } else if (this.entityType === EntityType.SHELF) { - this.shelfService.updateSort(this.entity?.id!, sortOption).subscribe(); - } } private setSelectedSortFromEntity(entity: Library | Shelf | null): void { diff --git a/booklore-ui/src/app/book/service/library.service.ts b/booklore-ui/src/app/book/service/library.service.ts index fa274218f..7c2836491 100644 --- a/booklore-ui/src/app/book/service/library.service.ts +++ b/booklore-ui/src/app/book/service/library.service.ts @@ -113,24 +113,6 @@ export class LibraryService { ); } - updateSort(libraryId: number, sort: SortOption): Observable { - return this.http.put(`${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 { return this.bookService.bookState$.pipe( map(state => (state.books || []).filter(book => book.libraryId === libraryId).length) diff --git a/booklore-ui/src/app/book/service/shelf.service.ts b/booklore-ui/src/app/book/service/shelf.service.ts index 60c0b145e..fd7a5d857 100644 --- a/booklore-ui/src/app/book/service/shelf.service.ts +++ b/booklore-ui/src/app/book/service/shelf.service.ts @@ -83,24 +83,6 @@ export class ShelfService { ); } - updateSort(shelfId: number, sort: SortOption): Observable { - return this.http.put(`${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 { return this.http.delete(`${this.url}/${shelfId}`).pipe( tap(() => {