evil-vue
Version:
Evil vue3 writing, similar to angular writing Dependency injection
35 lines (34 loc) • 1.65 kB
TypeScript
import { AxiosDefaults, AxiosInterceptorManager, AxiosPromise, AxiosRequestConfig, AxiosResponse } from 'axios';
import type { HttpClientConfig } from './config';
import { HttpInterceptorHandler } from './interceptor';
import { Logger } from './logger.interceptor';
declare class HttpClient {
private interceptorHandler;
private logger;
static defaults: AxiosDefaults;
static interceptors: {
request: AxiosInterceptorManager<AxiosRequestConfig>;
response: AxiosInterceptorManager<AxiosResponse>;
};
private axiosInstance;
constructor(interceptorHandler: HttpInterceptorHandler, logger: Logger, config?: HttpClientConfig);
moduleService: boolean;
private LoggerInterceptorRequest;
private LoggerInterceptorResponse;
showLog(): void;
hiddenLog(): void;
get defaults(): AxiosDefaults<any>;
get interceptors(): {
request: AxiosInterceptorManager<AxiosRequestConfig<any>>;
response: AxiosInterceptorManager<AxiosResponse<any, any>>;
};
request<T = any>(config: AxiosRequestConfig): AxiosPromise<T>;
get<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
head<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): AxiosPromise<T>;
delete<T = any>(url: string, config?: AxiosRequestConfig): AxiosPromise<T>;
}
export default HttpClient;
export { HttpClient };