@autofleet/network 1.2.6 → 1.2.7

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.
Files changed (2) hide show
  1. package/index.js +2 -2
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -125,11 +125,11 @@ module.exports = class Network {
125
125
  async getAllPages(url, options = {}) {
126
126
  let currentResult = [];
127
127
  let resultsInFirstPage = null;
128
- let lastResultsSize = 0;
128
+ let lastResultsSize = null;
129
129
 
130
130
  const localOptions = { params: {}, ...options };
131
131
  localOptions.params.page = 1;
132
- while(localOptions.params.page === 1 || lastResultsSize === resultsInFirstPage) {
132
+ while((localOptions.params.page === 1 || lastResultsSize === resultsInFirstPage) && lastResultsSize !== 0) {
133
133
  const { data } = await this.get(url, localOptions);
134
134
  lastResultsSize = data.length;
135
135
  if(localOptions.params.page === 1) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autofleet/network",
3
- "version": "1.2.6",
3
+ "version": "1.2.7",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {