The value of next_page and prev_page when calling api.query

In the JS documentation (https://prismic.io/docs/javascript/query-the-api/the-response-object), the next_page and prev_page values are described as returning “The next/prev page number in the pagination”. However, when I console out these values I get a URL to the next/prev set of results not the page number.

console.log(response['next_page'])

I’m not sure if the issue here is with the documentation or the result returned but my preference here would definitely be to get the next/prev page number as an integer not a URL. At the moment I work around this manually using the page number the user has given and the total_pages value from the response but ideally I’d like to be able to use the relevant response fields.

Hi @ant, thanks for pointing this out. This is an error in the documentation that I just corrected.

I will let the @features-team know about your suggestion and we will add this to our feature request tracker as a possible improvement for the future.

I’m glad that you already have a workaround using the total_pages value so that you aren’t blocked by this.