perf: the request client upload function supports more parameters (#4439)

This commit is contained in:
Vben
2024-09-19 22:13:43 +08:00
committed by GitHub
parent 161820dbc1
commit 4765158510
3 changed files with 13 additions and 8 deletions

View File

@@ -11,11 +11,14 @@ class FileUploader {
public async upload(
url: string,
file: Blob | File,
data: { file: Blob | File } & Record<string, any>,
config?: AxiosRequestConfig,
): Promise<AxiosResponse> {
const formData = new FormData();
formData.append('file', file);
Object.entries(data).forEach(([key, value]) => {
formData.append(key, value);
});
const finalConfig: AxiosRequestConfig = {
...config,