Template
1
0
mirror of https://github.com/un-pany/v3-admin-vite.git synced 2025-04-20 19:09:21 +08:00

feat: 新增 service.ts 对二进制数据的处理逻辑 (#86)

This commit is contained in:
pddzl 2023-06-08 09:45:23 +08:00 committed by GitHub
parent 246f29e8c3
commit b40df6c6ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -19,6 +19,10 @@ function createService() {
(response) => {
// apiData 是 api 返回的数据
const apiData = response.data
// 二进制数据则直接返回
if (response.request.responseType === "blob" || response.request.responseType === "arraybuffer") {
return apiData
}
// 这个 code 是和后端约定的业务 code
const code = apiData.code
// 如果没有 code, 代表这不是项目后端开发的 api