New subscribe pattern
This commit is contained in:
@@ -43,8 +43,7 @@
|
||||
|
||||
<div class="book-card-container" *ngIf="bookState?.books as books">
|
||||
|
||||
<app-book-table *ngIf="value === 'table'&& books.length > 0" [books]="books" (selectedBooksChange)="onSelectedBooksChange($event)"
|
||||
[sortOption]="selectedSort"></app-book-table>
|
||||
<app-book-table *ngIf="value === 'table'&& books.length > 0" [books]="books" (selectedBooksChange)="onSelectedBooksChange($event)" [sortOption]="selectedSort"></app-book-table>
|
||||
|
||||
<virtual-scroller *ngIf="value === 'grid'" class="virtual-scroller" #scroll [items]="books">
|
||||
<div class="grid grid-cols-12 gap-4" #container>
|
||||
|
||||
@@ -269,12 +269,14 @@ export class BookBrowserComponent implements OnInit {
|
||||
unshelfBooks() {
|
||||
if (this.entity) {
|
||||
this.bookService.updateBookShelves(this.selectedBooks, new Set(), new Set([this.entity.id])).subscribe(
|
||||
() => {
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: 'Books shelves updated'});
|
||||
this.selectedBooks = new Set<number>();
|
||||
},
|
||||
() => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to update books shelves'});
|
||||
{
|
||||
next: () => {
|
||||
this.messageService.add({severity: 'info', summary: 'Success', detail: 'Books shelves updated'});
|
||||
this.selectedBooks = new Set<number>();
|
||||
},
|
||||
error: () => {
|
||||
this.messageService.add({severity: 'error', summary: 'Error', detail: 'Failed to update books shelves'});
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user