0508修改

This commit is contained in:
lzm
2026-05-08 09:33:34 +08:00
parent 2e3a6cc1ec
commit 9ea02751de
11 changed files with 328 additions and 51 deletions

View File

@@ -14,6 +14,12 @@ const request = (option: any) => {
}
})
}
export interface DownloadResponseData {
data: Blob
fileName?: string
}
export default {
get: async <T = any>(option: any) => {
const res = await request({ method: 'GET', ...option })
@@ -35,9 +41,9 @@ export default {
const res = await request({ method: 'PUT', ...option })
return res.data as unknown as T
},
download: async <T = any>(option: any) => {
download: async <T = DownloadResponseData>(option: any) => {
const res = await request({ method: 'GET', responseType: 'blob', ...option })
return res as unknown as Promise<T>
return res as T
},
upload: async <T = any>(option: any) => {
option.headersType = 'multipart/form-data'