From ed451cdee250b050fb84ed030840d36ef8508851 Mon Sep 17 00:00:00 2001 From: Boris Voropaev Date: Wed, 14 Feb 2024 14:19:06 +0300 Subject: [PATCH] search --- .../pages/sections/search/search-sections.component.ts | 2 +- src/app/_modules/pagination/pagination.component.ts | 2 +- src/app/_modules/search/page/search-page.component.ts | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/_modules/pages/sections/search/search-sections.component.ts b/src/app/_modules/pages/sections/search/search-sections.component.ts index bccdf1b..4744973 100644 --- a/src/app/_modules/pages/sections/search/search-sections.component.ts +++ b/src/app/_modules/pages/sections/search/search-sections.component.ts @@ -25,7 +25,7 @@ export class SearchSectionsComponent { this.controlsSubscription = this.listsService.controls(this.listId).subscribe(controls => { this.fetch(controls); }); - this.resultsSubscription = this.listsService.result(this.listId).subscribe(val => { + this.resultsSubscription = this.listsService.result(this.listId)?.subscribe(val => { this.items = val?.data || []; }); } diff --git a/src/app/_modules/pagination/pagination.component.ts b/src/app/_modules/pagination/pagination.component.ts index d0452a8..be9448c 100644 --- a/src/app/_modules/pagination/pagination.component.ts +++ b/src/app/_modules/pagination/pagination.component.ts @@ -38,7 +38,7 @@ export class PaginationComponent { return (val < this.data?.total) ? val : this.data?.total; } get currentPage() { - return this.listsService.result(this.listId).value.meta?.pagination?.currentPage; + return this.listsService.result(this.listId).value?.meta?.pagination?.currentPage; } get total() { return this.data?.totalPages || 1; diff --git a/src/app/_modules/search/page/search-page.component.ts b/src/app/_modules/search/page/search-page.component.ts index 8f13ca7..7702648 100644 --- a/src/app/_modules/search/page/search-page.component.ts +++ b/src/app/_modules/search/page/search-page.component.ts @@ -24,13 +24,13 @@ export class SearchPageComponent { entriesSubscription: Subscription; constructor(private listsService: ListsService) { - this.pagesSubscription = this.listsService.result('sections-list').subscribe(res => { + this.pagesSubscription = this.listsService.result('sections-list')?.subscribe(res => { this.setCount('pages', res?.meta?.pagination?.total); }); - this.publicationsSubscription = this.listsService.result('publications-list').subscribe(res => { + this.publicationsSubscription = this.listsService.result('publications-list')?.subscribe(res => { this.setCount('publications', res?.meta?.pagination?.total); }); - this.entriesSubscription = this.listsService.result('common-entries').subscribe(res => { + this.entriesSubscription = this.listsService.result('common-entries')?.subscribe(res => { this.setCount('entries', res?.meta?.pagination?.total); }); }