robsontenorio/vue-api-query

Adding offset as an additional default parameterNames.

Closed this issue · 2 comments

For pagination, we have page and limit as parameter names. But limit offset pagination is also something most people use. It would be nice to have this as one of the parameterNames.

This not only affects parameter names, the package has dedicated functions as well (.page(), .limit(), see pagination docs).

The JSON:API spec has several ideas how to do pagination (number/size, offset/limit, cursor). Should all of those be functions and parameters as well?

As for now, you can always set parameters manually in a model query:

  // Assuming we have a pagination object in data or equivalent...:
  .params({
    "page[size]": this.pagination.rowsPerPage,
    "page[number]": this.pagination.page
  })
  .get()
  .then(async response => {
    // ...
  });

Edit: typo

Understood. Closing this issue now.