Axios recursion for paginating an api with a cursor
问题 How can I paginate an API with a cursor using axios ? I would like to recursively call this function until response.data.length < 1 and return the entire array with all items in the collection when it is done. Also, worth noting, I would have to pass the cursor into subsequent calls. function getUsers () { return axios.get('/users') // API supports a cursor param (?after=) .then(response => { // returns an array with a cursor // see response below console.log(response.data) }) } Example