给予axios封装的observable请求类
给予axios封装的observable请求类
增加拦截器钩子函数,并能处理重复的请求
You can install with npm.
npm install axios-rx-observable
import Fetch from '@types/axios-rx-observable'
const Fetch = new Fetch({
beforeRequest?: (nowConfig?: AxiosRequestConfig, initConfig?: AxiosRequestConfig) => void | AxiosRequestConfig;
requestError?: (err?: Error, initConfig?: AxiosRequestConfig) => void | AxiosRequestConfig;
beforeResponse?: (responseData: AxiosResponse, nowConfig?: AxiosRequestConfig, initConfig?: AxiosRequestConfig) => any;
responseError?: (err?: Error, initConfig?: AxiosRequestConfig) => void | AxiosRequestConfig;
...AxiosRequestConfig;
})
get (url: string, data?: object, options?: object)
post (url: string, data?: object, options?: object)
put (url: string, data?: object, options?: object)
delete (url: string, data?: object, options?: object)