2022-03-27 20:10:28 +08:00

24 lines
832 B
TypeScript

import { AxiosRequestConfig, AxiosResponse } from 'axios';
export interface RequestBuildConfig {
request: {
dataField: string
}
}
type RequestInterceptor = (value: AxiosRequestConfig) => AxiosRequestConfig | [(value: AxiosRequestConfig) => AxiosRequestConfig, (error: any) => any];
type ResponseInterceptor = (value: AxiosResponse) => AxiosResponse | [(value: AxiosResponse) => AxiosResponse, (error: any) => any];
export interface RequestRuntimeConfig {
request: {
responseDataAdaptor?<T>(data: T): T;
closeResDataCheck?: boolean;
requestInterceptors?: RequestInterceptor[];
responseInterceptors?: ResponseInterceptor[];
errorHandler: {
[key: string]: (error: { response: AxiosResponse } | AxiosResponse) => void;
};
} & AxiosRequestConfig;
}