@varlet/axle 0.2.9 → 0.2.10

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/es/index.js +4 -7
  2. package/package.json +1 -1
package/es/index.js CHANGED
@@ -204,15 +204,12 @@ function responseRetryInterceptor(options) {
204
204
  async onRejected(error) {
205
205
  var _a, _b;
206
206
  const matcher = createMatcher(options.include, options.exclude);
207
- if (!matcher((_a = error.config.method) != null ? _a : "", (_b = error.config.url) != null ? _b : "")) {
207
+ if (!matcher((_a = error.config.method) != null ? _a : "", (_b = error.config.url) != null ? _b : "") || isCancel(error)) {
208
208
  return Promise.reject(error);
209
209
  }
210
210
  const { count = 1 } = options;
211
211
  let retryCount = 0;
212
- if (isCancel(error)) {
213
- return Promise.reject(error);
214
- }
215
- async function loop() {
212
+ async function retry() {
216
213
  try {
217
214
  retryCount++;
218
215
  return await axios2.create()(error.config);
@@ -220,10 +217,10 @@ function responseRetryInterceptor(options) {
220
217
  if (retryCount === count) {
221
218
  return Promise.reject(error2);
222
219
  }
223
- return loop();
220
+ return retry();
224
221
  }
225
222
  }
226
- return loop();
223
+ return retry();
227
224
  },
228
225
  options: options.axiosInterceptorOptions
229
226
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@varlet/axle",
3
- "version": "0.2.9",
3
+ "version": "0.2.10",
4
4
  "description": "Progressive request tool based on axios",
5
5
  "type": "module",
6
6
  "main": "es/index.js",