perf: format code with better style (#5283)

This commit is contained in:
Vben
2025-01-01 11:39:49 +08:00
committed by GitHub
parent 4d81b9d18d
commit 081d2aed23
288 changed files with 1805 additions and 2164 deletions

View File

@@ -11,7 +11,7 @@ class FileUploader {
public async upload(
url: string,
data: { file: Blob | File } & Record<string, any>,
data: Record<string, any> & { file: Blob | File },
config?: AxiosRequestConfig,
): Promise<AxiosResponse> {
const formData = new FormData();

View File

@@ -5,6 +5,8 @@ import type {
CreateAxiosDefaults,
} from 'axios';
import type { RequestClientOptions } from './types';
import { bindMethods, merge } from '@vben/utils';
import axios from 'axios';
@@ -12,20 +14,19 @@ import axios from 'axios';
import { FileDownloader } from './modules/downloader';
import { InterceptorManager } from './modules/interceptor';
import { FileUploader } from './modules/uploader';
import { type RequestClientOptions } from './types';
class RequestClient {
private readonly instance: AxiosInstance;
public addRequestInterceptor: InterceptorManager['addRequestInterceptor'];
public addResponseInterceptor: InterceptorManager['addResponseInterceptor'];
public addResponseInterceptor: InterceptorManager['addResponseInterceptor'];
public download: FileDownloader['download'];
// 是否正在刷新token
public isRefreshing = false;
// 刷新token队列
public refreshTokenQueue: ((token: string) => void)[] = [];
public upload: FileUploader['upload'];
private readonly instance: AxiosInstance;
/**
* 构造函数用于创建Axios实例