I am trying to update multiple items at once, and I have to make a network request for each item. I am using fetch for making the request.
Here's an example of what I mean:
const updateItems = items => items.forEach(item => api.create(item))
api.create
might look something like this:
create: item => fetch(url, config(item)).then(handleErr).then(handleRes)
How can I make ensure that I am batching all things successfully? Each create
is a promise, but I am having trouble using Promise.all as a wrapper because I get the following error: Cannot read property 'Symbol(Symbol.iterator)' of undefined
However, the updates are successful, so I'm doing something wrong!