Refactor BooksBrowserComponent

This commit is contained in:
aditya.chandel
2024-12-25 22:01:23 -07:00
parent 383a3189bb
commit 7345f3f0ee
9 changed files with 186 additions and 170 deletions
@@ -3,7 +3,7 @@ import {BehaviorSubject, Observable, of} from 'rxjs';
import {catchError, map} from 'rxjs/operators';
import {HttpClient} from '@angular/common/http';
import {Shelf} from '../model/shelf.model';
import {Sort} from '../model/sort.model';
import {SortOption} from '../model/sort.model';
@Injectable({
providedIn: 'root'
@@ -37,7 +37,7 @@ export class ShelfService {
);
}
updateSort(shelfId: number, sort: Sort): Observable<Shelf> {
updateSort(shelfId: number, sort: SortOption): Observable<Shelf> {
return this.http.put<Shelf>(`${this.url}/${shelfId}/sort`, { shelfId, sort }).pipe(
map(updatedShelf => {
const updatedShelves = this.shelves.value.map(shelf =>