@autofleet/network 1.4.8-beta-4 → 1.4.8-beta-6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +4 -4
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -165,9 +165,9 @@ module.exports = class Network {
|
|
|
165
165
|
async getAllPagesFromQueryEndpoint(url, options = {}) {
|
|
166
166
|
let currentResult = [];
|
|
167
167
|
|
|
168
|
-
let
|
|
169
|
-
let page =
|
|
170
|
-
while(
|
|
168
|
+
let moreResultsToLoad = true;
|
|
169
|
+
let page = 1;
|
|
170
|
+
while(moreResultsToLoad && page < 100) {
|
|
171
171
|
const { data } = await this.post(url, {
|
|
172
172
|
...options,
|
|
173
173
|
page: page,
|
|
@@ -175,7 +175,7 @@ module.exports = class Network {
|
|
|
175
175
|
const { rows, count } = data;
|
|
176
176
|
page += 1;
|
|
177
177
|
currentResult = currentResult.concat(rows);
|
|
178
|
-
|
|
178
|
+
moreResultsToLoad = currentResult.length < count;
|
|
179
179
|
}
|
|
180
180
|
|
|
181
181
|
return currentResult;
|