fix(Strapi Node): Fix issue with pagination (#4991)

This commit is contained in:
Adrián Martínez 2023-07-03 17:05:28 +02:00 committed by कारतोफ्फेलस्क्रिप्ट™
parent c906e7391b
commit 4253b48b26

View file

@ -92,7 +92,7 @@ export async function strapiApiRequestAllItems(
let responseData; let responseData;
if (apiVersion === 'v4') { if (apiVersion === 'v4') {
query['pagination[pageSize]'] = 20; query['pagination[pageSize]'] = 20;
query['pagination[page]'] = 0; query['pagination[page]'] = 1;
do { do {
({ data: responseData } = await strapiApiRequest.call( ({ data: responseData } = await strapiApiRequest.call(
this, this,
@ -103,7 +103,7 @@ export async function strapiApiRequestAllItems(
undefined, undefined,
headers, headers,
)); ));
query['pagination[page]'] += query['pagination[pageSize]']; query['pagination[page]']++;
returnData.push.apply(returnData, responseData as IDataObject[]); returnData.push.apply(returnData, responseData as IDataObject[]);
} while (responseData.length !== 0); } while (responseData.length !== 0);
} else { } else {