1
1
mirror of https://github.com/n8n-io/n8n.git synced 2024-11-09 17:50:52 +03:00

🐛 Fix issue with pagination - Mautic node (#2686)

This commit is contained in:
Ricardo Espinoza 2022-01-21 04:42:14 -05:00 committed by GitHub
parent 2e57d86fd6
commit 9fc1d16e7c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -75,15 +75,13 @@ export async function mauticApiRequestAllItems(this: IHookFunctions | IExecuteFu
do {
responseData = await mauticApiRequest.call(this, method, endpoint, body, query);
const values = Object.values(responseData[propertyName]);
for (const value of values) {
data.push(value as IDataObject);
}
returnData.push.apply(returnData, data);
query.start++;
//@ts-ignore
returnData.push.apply(returnData, values);
query.start += query.limit;
data = [];
} while (
responseData.total !== undefined &&
((query.limit * query.start) - parseInt(responseData.total, 10)) < 0
(returnData.length - parseInt(responseData.total, 10)) < 0
);
return returnData;