[Vuejs]-Run a vuejs code after all axios requests are completed

3👍

Pass all of your axios calls to Promise.all() which will resolve after all axios calls have been made.

Promise.all([axios.get(url1), axios.get(url2), axios.get(url3)])
  .then((allResults) => {
    console.log("All axios calls have been made!")
})

Promise.all() requires an array of promises as its argument and the axios.get() method returns a promise.

All returned values from Promise.all() will be in order of the Promises passed, regardless of completion order.

More info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Promise/all

👤cwoods

Leave a comment