I am looking to retrieve data from all the projects stored on my GitLab server. As I understand, GitLab usually displays a default of 20 projects per page, so I need to adjust the setting to show more projects at once:
https://gitlab-repo.com/api/v4/projects?per_page=100
This results in the following axios code:
const url='https://gitlab-repo.com/api/v4/projects?per_page=100'
const vm = new Vue({
el: "#app",
data: {
results: [],
loading: true,
errored: false
},
mounted() {
axios
.get(url)
.then(response => (this.results = response.data))
.catch(error => {
console.log(error)
this.errored = true
})
.finally(() => this.loading = false)
}
})
The challenge is that GitLab can only display up to 100 projects per page, and I have more projects than that.
I have considered adding a condition regarding the number of projects in the params
section of the axios get function but am unsure how to execute that.
Is there a way for me to specify in my axios request that if the number of projects exceeds 100, I want to retrieve the additional data from the subsequent page(s)?