axios-interface
Advanced tools
Comparing version 1.4.1 to 1.4.2
@@ -47,3 +47,6 @@ /** | ||
const config = combinedOnPending(params, combinedOptions); | ||
return axios.request(config).then(handleResolve, handleReject); | ||
const requestPromise = config instanceof Promise | ||
? config.then(awaitedConfig => axios.request(awaitedConfig)) | ||
: axios.request(config); | ||
return requestPromise.then(handleResolve, handleReject); | ||
}; | ||
@@ -50,0 +53,0 @@ const { interpolate = /{(\w+)}/g } = defaultOptions; |
@@ -5,3 +5,3 @@ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; | ||
export declare type UrlTemplate = string; | ||
export declare type OnPending = <TParams>(params: TParams, options: Options) => Options; | ||
export declare type OnPending = <TParams>(params: TParams, options: Options) => Options | Promise<Options>; | ||
export declare type OnResolve = <TParams>(response: AxiosResponse, params: TParams, options: Options) => any; | ||
@@ -8,0 +8,0 @@ export declare type OnReject = <TParams>(response: AxiosError, params: TParams, options: Options) => any; |
@@ -62,3 +62,6 @@ "use strict"; | ||
var config = combinedOnPending(params, combinedOptions); | ||
return axios_1.default.request(config).then(handleResolve, handleReject); | ||
var requestPromise = config instanceof Promise | ||
? config.then(function (awaitedConfig) { return axios_1.default.request(awaitedConfig); }) | ||
: axios_1.default.request(config); | ||
return requestPromise.then(handleResolve, handleReject); | ||
}; | ||
@@ -65,0 +68,0 @@ var _a = defaultOptions.interpolate, interpolate = _a === void 0 ? /{(\w+)}/g : _a; |
@@ -5,3 +5,3 @@ import { AxiosRequestConfig, AxiosResponse, AxiosError } from 'axios'; | ||
export declare type UrlTemplate = string; | ||
export declare type OnPending = <TParams>(params: TParams, options: Options) => Options; | ||
export declare type OnPending = <TParams>(params: TParams, options: Options) => Options | Promise<Options>; | ||
export declare type OnResolve = <TParams>(response: AxiosResponse, params: TParams, options: Options) => any; | ||
@@ -8,0 +8,0 @@ export declare type OnReject = <TParams>(response: AxiosError, params: TParams, options: Options) => any; |
{ | ||
"name": "axios-interface", | ||
"version": "1.4.1", | ||
"version": "1.4.2", | ||
"description": "create interface from axios", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
55749
1345