Skip to content

Commit

Permalink
fix(monicaCrm Node): fix pagination when using return all
Browse files Browse the repository at this point in the history
  • Loading branch information
Joffcom authored Sep 2, 2022
1 parent 49c85a1 commit 82827d0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/nodes-base/nodes/MonicaCrm/GenericFunctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ export async function monicaCrmApiRequestAllItems(
const limit = this.getNodeParameter('limit', 0, 0) as number;

let totalItems = 0;
qs.page = 1;
qs.limit = 100;

let responseData;
const returnData: IDataObject[] = [];
Expand All @@ -78,7 +80,7 @@ export async function monicaCrmApiRequestAllItems(
if (!forLoader && !returnAll && returnData.length > limit) {
return returnData.slice(0, limit);
}

qs.page++;
totalItems = responseData.meta.total;
} while (totalItems > returnData.length);

Expand Down

0 comments on commit 82827d0

Please sign in to comment.