update: 兼容旧版本上传 增加ImageUploadOld/FileUploadOld(下个版本将移除)
This commit is contained in:
@@ -19,18 +19,21 @@ export interface UploadResult {
|
||||
/**
|
||||
* 通过单文件上传接口
|
||||
* @param file 上传的文件
|
||||
* @param otherData 其他请求参数 后端拓展可能会用到
|
||||
* @param options 一些配置项
|
||||
* @param options.onUploadProgress 上传进度事件
|
||||
* @param options.signal 上传取消信号
|
||||
* @param options.otherData 其他请求参数 后端拓展可能会用到
|
||||
* @returns 上传结果
|
||||
*/
|
||||
export function uploadApi(
|
||||
file: Blob | File,
|
||||
otherData?: Record<string, any>,
|
||||
options?: { onUploadProgress?: AxiosProgressEvent; signal?: AbortSignal },
|
||||
options?: {
|
||||
onUploadProgress?: AxiosProgressEvent;
|
||||
otherData?: Record<string, any>;
|
||||
signal?: AbortSignal;
|
||||
},
|
||||
) {
|
||||
const { onUploadProgress, signal } = options ?? {};
|
||||
const { onUploadProgress, signal, otherData = {} } = options ?? {};
|
||||
return requestClient.upload<UploadResult>(
|
||||
'/resource/oss/upload',
|
||||
{ file, ...otherData },
|
||||
|
Reference in New Issue
Block a user