Chaining axios call based on array
See original GitHub issueHow do I do this dynamically
var array = [0,1,2];
axios.get('api/' + array[0]).then(response => {
axios.get('api/' + array[1]).then(response => {
axios.get('api/' + array[2]).then(response => {
alert('done');
});
});
});
how do I chain axios call based on array?
Issue Analytics
- State:
- Created 6 years ago
- Reactions:2
- Comments:5
Top Results From Across the Web
Axios: chaining multiple API requests - reactjs - Stack Overflow
axios.spread() is used to spread the array of arguments into multiple arguments, so that all data can be passed to the function.
Read more >How to send multiple requests using axios - Storyblok
Let us start with a small task and sending one request using Axios itself. First, we import axios and define the API/URL we...
Read more >Using axios.all to make concurrent requests - LogRocket Blog
This request returns an array as a response and the data in the array is ordered according to our endpoints array, meaning Axios...
Read more >Use Promise.all to Stop Async/Await from Blocking Execution ...
An async chain: one operation that loads an array, then a series of calls that depend on the result of the original call....
Read more >Axios React – How to Make Get, Post, and Delete API Requests
Axios [https://axios-http.com/] is an HTTP client library based on promises. It makes sending asynchronous HTTP requests to REST endpoints ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Something like this should work:
Nothing to worry, I am just trying to say if anyone wants to add specific code as per his/her project need then those codes will go above . index++;