Using axios
in conjunction with vue.js
allows me to implement unlimited pagination for fetching data. Everything seems to be working well, except for one scenario: when there is no data available to render.
fetchData() {
this.loading = true
this.page++;
axios.get(this.BASE_URL + '/api/jokes/'+'?page='+this.page).then(
response =>
//what should I do if the response has no data?
this.jokes = response.data).catch(function (error) {
console.log(error);
});
I'm trying to figure out how to prevent rendering when we have reached the last page and there are no more data elements to display.
Despite checking the documentation, I have not been able to find a solution to my query.