location eingebaut, back buttons angeglichen, paging & criteria korrigiert

This commit is contained in:
2024-08-08 17:25:00 +02:00
parent 7df5d32cc4
commit 69b0a83b1e
21 changed files with 196 additions and 328 deletions

View File

@@ -49,10 +49,10 @@ export class BusinessListingsComponent {
private route: ActivatedRoute,
private searchService: SearchService,
) {
this.criteria = getCriteriaStateObject('business');
this.criteria = getCriteriaStateObject('businessListings');
this.init();
this.searchService.currentCriteria.subscribe(criteria => {
if (criteria && criteria.criteriaType === 'business') {
if (criteria && criteria.criteriaType === 'businessListings') {
this.criteria = criteria as BusinessListingCriteria;
this.search();
}
@@ -66,11 +66,11 @@ export class BusinessListingsComponent {
}
async search() {
//this.listings = await this.listingsService.getListingsByPrompt(this.criteria);
const listingReponse = await this.listingsService.getListings(this.criteria, 'business');
this.listings = listingReponse.results;
this.totalRecords = listingReponse.totalCount;
this.pageCount = this.totalRecords % LISTINGS_PER_PAGE === 0 ? this.totalRecords / LISTINGS_PER_PAGE : Math.floor(this.totalRecords / LISTINGS_PER_PAGE) + 1;
this.page = this.criteria.page ? this.criteria.page : 1;
this.cdRef.markForCheck();
this.cdRef.detectChanges();
}