danielbonifacio-sdk
Advanced tools
Comparing version 2.7.3 to 2.8.0
@@ -1,7 +0,8 @@ | ||
import { AxiosResponse } from "axios"; | ||
import { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
declare class Service { | ||
protected static Http: import("axios").AxiosInstance; | ||
protected static getData: typeof getData; | ||
static setRequestInterceptors(onFulfilled: (request: AxiosRequestConfig) => AxiosRequestConfig | Promise<AxiosRequestConfig>, onRejected: (error: any) => any): void; | ||
} | ||
declare function getData<T>(res: AxiosResponse<T>): T; | ||
export default Service; |
@@ -13,2 +13,5 @@ "use strict"; | ||
} | ||
Service.setRequestInterceptors = function (onFulfilled, onRejected) { | ||
Http.interceptors.request.use(onFulfilled, onRejected); | ||
}; | ||
Service.Http = Http; | ||
@@ -15,0 +18,0 @@ Service.getData = getData; |
{ | ||
"name": "danielbonifacio-sdk", | ||
"version": "2.7.3", | ||
"version": "2.8.0", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
@@ -1,2 +0,2 @@ | ||
import axios, { AxiosResponse } from "axios"; | ||
import axios, { AxiosRequestConfig, AxiosResponse } from "axios"; | ||
import handleAxiosResponseError from "./utils/handleAxiosResponseError"; | ||
@@ -10,2 +10,11 @@ import handleAxiosResponseSuccess from "./utils/handleAxiosResponseSuccess"; | ||
protected static getData = getData; | ||
public static setRequestInterceptors( | ||
onFulfilled: ( | ||
request: AxiosRequestConfig | ||
) => AxiosRequestConfig | Promise<AxiosRequestConfig>, | ||
onRejected: (error: any) => any | ||
) { | ||
Http.interceptors.request.use(onFulfilled, onRejected); | ||
} | ||
} | ||
@@ -12,0 +21,0 @@ |
177518
4912