Currently, I've been attempting to iterate through an array of IDs and pass them into a function (this.handleTransfer) that makes API calls. My goal is for the next iteration to only proceed when a response is received from the previous one. In my quest to achieve this, I turned to Google in search of how promises can help me with this task. However, upon implementing the solution I found online, I encountered the following error after the first iteration:
TypeError: e(...).then is not a function.
The code block responsible for the error was identified as:
return e().then(Array.prototype.concat.bind(t))
This is my current code setup:
const promiseSerial = funcs =>
funcs.reduce((promise, func) =>
promise.then(result => func().then(Array.prototype.concat.bind(result))),
Promise.resolve([]))
const payments = this.payIDArray;
const funcs = payments.map(payment => () => this.handleTransfer(payment))
promiseSerial(funcs)
.then(console.log.bind(console))
.catch(console.error.bind(console))
It's worth mentioning that I am utilizing the VueJS framework.