I need to chain a few API requests from the Google Maps API, and I\'m trying to do it with Axios.
Here is the first request, which is in componentWillMount()
Have you used axios.all ? You can try with something similar:
axios.all([axios.get(`firstrequest`),
axios.get(`secondrequest`),
axios.get(`thirdrequest`)])
.then(axios.spread((firstResponse, secondResponse, thirdResponse) => {
console.log(firstResponse.data,secondResponse.data, thirdResponse.data);
}))
.catch(error => console.log(error));
This will take all your get and will put it inside a response that has to be called with .data like:
firstResponse.data