export class ProductListComponent { constructor(productService) { this.productService = new ProductService(); this.init(); } function init() { this.productService.getProduct('storeId') .then({ function (data) { let storeId = data.data.pocSearch[0].id; // call productService function buildTemplate(storeId); }) .catch(error => console.error('TODO: tratar erro ', error)); } function buildTemplate(products) { const element = document.getElementById('product-list'); // map of products let productItem = products.map(product => `
${product.productVariants[0].price}