@hyper-fetch/core 5.4.1 → 5.6.0
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/dist/browser/index.cjs.js +20 -0
- package/dist/browser/index.cjs.js.map +2 -2
- package/dist/browser/index.esm.js +20 -0
- package/dist/browser/index.esm.js.map +2 -2
- package/dist/index.cjs.js +20 -0
- package/dist/index.cjs.js.map +2 -2
- package/dist/index.d.ts +20 -0
- package/dist/index.esm.js +20 -0
- package/dist/index.esm.js.map +2 -2
- package/package.json +1 -1
- package/src/client/client.ts +50 -0
package/package.json
CHANGED
package/src/client/client.ts
CHANGED
|
@@ -264,6 +264,16 @@ export class Client<
|
|
|
264
264
|
return this;
|
|
265
265
|
};
|
|
266
266
|
|
|
267
|
+
/**
|
|
268
|
+
* Method for removing listeners on auth.
|
|
269
|
+
* */
|
|
270
|
+
removeOnAuthInterceptors = (
|
|
271
|
+
callbacks: RequestInterceptorType[],
|
|
272
|
+
): Client<GlobalErrorType, Adapter, EndpointMapper> => {
|
|
273
|
+
this.__onAuthCallbacks = this.__onAuthCallbacks.filter((callback) => !callbacks.includes(callback));
|
|
274
|
+
return this;
|
|
275
|
+
};
|
|
276
|
+
|
|
267
277
|
/**
|
|
268
278
|
* Method for intercepting error responses. It can be used for example to refresh tokens.
|
|
269
279
|
*/
|
|
@@ -274,6 +284,16 @@ export class Client<
|
|
|
274
284
|
return this;
|
|
275
285
|
};
|
|
276
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Method for removing listeners on error.
|
|
289
|
+
* */
|
|
290
|
+
removeOnErrorInterceptors = (
|
|
291
|
+
callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
|
|
292
|
+
): Client<GlobalErrorType, Adapter, EndpointMapper> => {
|
|
293
|
+
this.__onErrorCallbacks = this.__onErrorCallbacks.filter((callback) => !callbacks.includes(callback));
|
|
294
|
+
return this;
|
|
295
|
+
};
|
|
296
|
+
|
|
277
297
|
/**
|
|
278
298
|
* Method for intercepting success responses.
|
|
279
299
|
*/
|
|
@@ -284,6 +304,16 @@ export class Client<
|
|
|
284
304
|
return this;
|
|
285
305
|
};
|
|
286
306
|
|
|
307
|
+
/**
|
|
308
|
+
* Method for removing listeners on success.
|
|
309
|
+
* */
|
|
310
|
+
removeOnSuccessInterceptors = (
|
|
311
|
+
callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
|
|
312
|
+
): Client<GlobalErrorType, Adapter, EndpointMapper> => {
|
|
313
|
+
this.__onSuccessCallbacks = this.__onSuccessCallbacks.filter((callback) => !callbacks.includes(callback));
|
|
314
|
+
return this;
|
|
315
|
+
};
|
|
316
|
+
|
|
287
317
|
/**
|
|
288
318
|
* Method of manipulating requests before sending the request.
|
|
289
319
|
*/
|
|
@@ -292,6 +322,16 @@ export class Client<
|
|
|
292
322
|
return this;
|
|
293
323
|
};
|
|
294
324
|
|
|
325
|
+
/**
|
|
326
|
+
* Method for removing listeners on request.
|
|
327
|
+
* */
|
|
328
|
+
removeOnRequestInterceptors = (
|
|
329
|
+
callbacks: RequestInterceptorType[],
|
|
330
|
+
): Client<GlobalErrorType, Adapter, EndpointMapper> => {
|
|
331
|
+
this.__onRequestCallbacks = this.__onRequestCallbacks.filter((callback) => !callbacks.includes(callback));
|
|
332
|
+
return this;
|
|
333
|
+
};
|
|
334
|
+
|
|
295
335
|
/**
|
|
296
336
|
* Method for intercepting any responses.
|
|
297
337
|
*/
|
|
@@ -302,6 +342,16 @@ export class Client<
|
|
|
302
342
|
return this;
|
|
303
343
|
};
|
|
304
344
|
|
|
345
|
+
/**
|
|
346
|
+
* Method for removing listeners on request.
|
|
347
|
+
* */
|
|
348
|
+
removeOnResponseInterceptors = (
|
|
349
|
+
callbacks: ResponseInterceptorType<any, null | GlobalErrorType, Adapter>[],
|
|
350
|
+
): Client<GlobalErrorType, Adapter, EndpointMapper> => {
|
|
351
|
+
this.__onResponseCallbacks = this.__onResponseCallbacks.filter((callback) => !callbacks.includes(callback));
|
|
352
|
+
return this;
|
|
353
|
+
};
|
|
354
|
+
|
|
305
355
|
/**
|
|
306
356
|
* Add persistent effects which trigger on the request lifecycle
|
|
307
357
|
*/
|