fix(Zoho Node): Fix pagination issue (#3129)

This commit is contained in:
Jonathan Bennetts 2022-04-14 08:41:14 +01:00 committed by GitHub
parent 5e54249c41
commit 47bbe9857b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -91,15 +91,13 @@ export async function zohoApiRequestAllItems(
const returnData: IDataObject[] = []; const returnData: IDataObject[] = [];
let responseData; let responseData;
let uri: string | undefined;
qs.per_page = 200; qs.per_page = 200;
qs.page = 0; qs.page = 1;
do { do {
responseData = await zohoApiRequest.call(this, method, endpoint, body, qs, uri); responseData = await zohoApiRequest.call(this, method, endpoint, body, qs);
if (Array.isArray(responseData) && !responseData.length) return returnData; if (Array.isArray(responseData) && !responseData.length) return returnData;
returnData.push(...responseData.data); returnData.push(...responseData.data);
uri = responseData.info.more_records;
qs.page++; qs.page++;
} while ( } while (
responseData.info.more_records !== undefined && responseData.info.more_records !== undefined &&