How can I loop an Axios request to fill an array of objects?
I'm trying to create a web interface that consumes a Star Wars API called swapi. It can be accessed in this link: https://swapi.co/
I can search for people, starships, planets, species and films. So, for instance, if I want to search for Luke Skywalker, I add /api/people/1/ like https://swapi.co/api/people/1/ .
So far so good.
Now, if I want every Star Wars characters, I simply remove the number 1, the url will be https://swapi.co/api/people/ and I will have the first ten characters out of 87, I think.
But I don't want 10. I want all of them... That makes me do a multiple request to grab all characters data. The problem is, if I use a loop to make the requests, let's say a while loop, it finishes all the search before the very first request brings the data to my code to treat it.
I'm using a global state through Redux and I'm calling Redux Thunk via componentDidMount(). It works fine, actually and the first ten characters data are retrieved and they fill my render method in React. But how can I make multiple requests without having a loop that ends up before those requests?