You’re not receiving notifications from this thread.
PAGY with Rails API Only
I've built a Rails API and have a separate Nuxt/Vue app for my front end. Looking to add server side pagination with Pagy and was wondering how i best to call the next 'X' number of results.
Pagy is working fine and giving me my first 20 records, but to call the next 20 I'm a little confused. Do i need to specify the URL from the front end as in 'localhost:3000/contacts?page=2' and send that, or can i pass some params like [:next] as mentioned in the docs. Has anyone had success with this or has an example?
Normally, you want to pass the next page number into the URL like you mentioned. That's how pagination links work when you display render them. Then the server knows which group of 20 records to grab next.
Perfect, thanks for the response Chris. It'll be sinmple to write a ?page=X +1 type method as the page comes in the header of the response. I could also utlise the 'link' from the header.... I'll have a play :)