You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
609 B
25 lines
609 B
import type { AxiosProgressEvent } from 'axios' |
|
import { defHttp } from '@/utils/http/axios' |
|
import type { UploadFileParams } from '@/types/axios' |
|
import { useGlobSetting } from '@/hooks/setting' |
|
|
|
const { uploadUrl = '' } = useGlobSetting() |
|
|
|
export interface UploadApiResult { |
|
message: string |
|
code: number |
|
url: string |
|
} |
|
|
|
/** |
|
* @description: Upload interface |
|
*/ |
|
export function uploadApi(params: UploadFileParams, onUploadProgress: (progressEvent: AxiosProgressEvent) => void) { |
|
return defHttp.uploadFile<UploadApiResult>( |
|
{ |
|
url: uploadUrl, |
|
onUploadProgress, |
|
}, |
|
params, |
|
) |
|
}
|
|
|