You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is there any way to access the "links" next and count on the response from Drupal?
I'd like to run successive fetches in a recursive loop but could only do this using .addPageOffset
@AtRiskMedia am glad that you found this module helpful and thanks for sharing your concern regarding pagination.
ATM, the module only provide a helper method generate your query. It is independent of result. It works with no Feedback. Keeping it independent of how the actual query is executed (fetch, axios, XMLHttpRequest...) helps keep it framework agnostic.
If we have to continue on this, then to get dynamic next links based on results, we would have to feed the current result into DrupalJsonApiParams and call some method like next get the url , fire the query, get the result feed it back to DrupalJsonApiParams and repeat ... I don't think it as a nice developer experience over what you have achieved in your sample code.
What you have done is a really a nice pattern to follow none the less. Alternatively, we can add this to project documentation (in README.md) so that people can benefit from this.
Activity
AtRiskMedia commentedon Mar 6, 2024
this what's working for me (in astro):
d34dman commentedon Mar 10, 2024
@AtRiskMedia am glad that you found this module helpful and thanks for sharing your concern regarding pagination.
ATM, the module only provide a helper method generate your query. It is independent of result. It works with no Feedback. Keeping it independent of how the actual query is executed (fetch, axios, XMLHttpRequest...) helps keep it framework agnostic.
If we have to continue on this, then to get dynamic
nextlinks based on results, we would have to feed the current result intoDrupalJsonApiParamsand call some method likenextget the url , fire the query, get the result feed it back toDrupalJsonApiParamsand repeat ... I don't think it as a nice developer experience over what you have achieved in your sample code.What you have done is a really a nice pattern to follow none the less. Alternatively, we can add this to project documentation (in README.md) so that people can benefit from this.
What do you think?
AtRiskMedia commentedon Mar 11, 2024
Awesome. Thanks @d34dman ... yes, even a quick note in the docs suggesting this as a pattern may be helpful for others.
Using DrupalJsonApiParams to craft the endpoint then follow the payload for subsequent urls to adhere to Drupal pagination: It's best of both worlds.
Issue #40 Add note about pagination in the main README file