Skip to content

Commit

Permalink
fix(api-axios): all logic for limit
Browse files Browse the repository at this point in the history
  • Loading branch information
Christie Baker authored and Christie Baker committed Dec 13, 2024
1 parent a722c65 commit e7e83fb
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/api-axios/src/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -287,10 +287,9 @@ export default class AvApi {
const response = await this.query(config);

const key = this.getQueryResultKey(response.data);
const length = response.data?.length;
const limit = response.data.limit || length <= response.data.totalCount ? Math.min(length, response.data.totalCount) || 1 : 1;
const totalPages = Math.ceil(response.data.totalCount / limit);
const result = response.data[key] || [];
const limit = response.data.limit || result.length <= response.data.totalCount ? Math.min(result.length, response.data.totalCount) || 1 : 1;
const totalPages = Math.ceil(response.data.totalCount / limit);

if (totalPages > 1) {
const otherPages = [];
Expand Down

0 comments on commit e7e83fb

Please sign in to comment.