return Promise.all(categoriesIdArray.map(categoryID => getSearchResults(' ', categoryID)));
const fetchAllProducts = async () => {
const categories = await GetActiveCategories();
const categoriesIdArray = categories.map(category => category.CategoryId);
return Promise.all(categoriesIdArray.map(categoryID => getSearchResults(' ', categoryID)));
}
is this enough, this is still returning a promise
const hotDeals = async () => {
const products = await fetchAllProducts();
return products.forEach(product => product.MRP/product.SellingPrice > .8)
}
const fetchAllProducts = async () => {
const categories = await GetActiveCategories();
const categoriesIdArray = categories.map(category => category.CategoryId);
return Promise.all(categoriesIdArray.map(categoryID => getSearchResults(' ', categoryID)));
}
const hotDeals = async () => {
const products = await fetchAllProducts();
console.log('PRODUCT DATA', products)
return products.forEach(product => product.MRP/product.SellingPrice > .8)
}
const displayHotDeals = async () => {
const data = await hotDeals();
console.log('DATA',data)
}
displayHotDeals();