How to set limit on amount of files returned from media library

Here is an example query:

What you need is start and limit.

const firstPageAdd = this.pagination.page === 1 ? 0 : 1
const query = this.$qs.stringify(
     {
       _q: this.q,
       sort: this.sort,
       start:
         (this.pagination.page - 1) * this.pagination.pageSize + firstPageAdd,
       limit: this.pagination.pageSize,
     },
     {
       encodeValuesOnly: true,
     }
   )
const files = await this.$axios.$get(`api/upload/files?${query}`)
1 Like