Skip to content

Instantly share code, notes, and snippets.

@Bigomby
Created October 26, 2018 08:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Bigomby/cfa8bcfef2e3cec2d27d80b3cf37ff3b to your computer and use it in GitHub Desktop.
Save Bigomby/cfa8bcfef2e3cec2d27d80b3cf37ff3b to your computer and use it in GitHub Desktop.
const orderItemListPromises = orderItemList.map(orderItems =>
Promise.all(
orderItems.map(orderItem => {
let filter = { where: { orderId: orderItem.order_id } };
myStadistic.shopId = orderItem.shopId;
listStatsToSave.push(myStadistic);
return axios.get(
url +
"/" +
orderItem.shopId +
"/receipts?filter=" +
JSON.stringify(filter),
{ headers }
);
})
)
);
await Promise.all(orderItemListPromises);
listStatsToSave.reduce((acc, current) => {
// Aquí haces tus cosas
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment