wip: hot-deals vendors

This commit is contained in:
2021-06-17 10:55:30 +02:00
parent 9821c004ec
commit fe2c064e30
3 changed files with 15 additions and 4 deletions
@@ -13,7 +13,7 @@ export class HotDealsWidgetComponent implements OnInit {
products: Product[] = [];
bestDealsProductIds = [];
amazonPrices = [];
productsPricesMap: any = {};
productsPricesMap = new Map();
@Input() numberOfProducts: number;
@Input() showProductPicture: boolean;
@Input() searchQuery: string;
@@ -52,6 +52,7 @@ export class HotDealsWidgetComponent implements OnInit {
default: {
this.getProductsByIds();
this.getAmazonPricesForBestDeals();
this.getVendors()
break;
}
}
@@ -79,6 +80,16 @@ export class HotDealsWidgetComponent implements OnInit {
);
}
getVendors(): void {
this.productsPricesMap.keys().forEach(
key => {
const currentDeal = this.productsPricesMap[key].lowestPrice;
this.apiService.getVendorById(currentDeal.vendor_id).subscribe(
vendor => {
this.productsPricesMap[key].vendor = vendor
})
})
}
getAmazonPricesForBestDeals(): void{