mirror of
https://github.com/un-pany/v3-admin-vite.git
synced 2025-04-21 11:29:20 +08:00
perf: 代码优化 utils/validate 和 utils/service
This commit is contained in:
parent
b40df6c6ad
commit
1d2a4ad9b6
@ -20,9 +20,8 @@ function createService() {
|
||||
// apiData 是 api 返回的数据
|
||||
const apiData = response.data
|
||||
// 二进制数据则直接返回
|
||||
if (response.request.responseType === "blob" || response.request.responseType === "arraybuffer") {
|
||||
return apiData
|
||||
}
|
||||
const responseType = response.request?.responseType
|
||||
if (responseType === "blob" || responseType === "arraybuffer") return apiData
|
||||
// 这个 code 是和后端约定的业务 code
|
||||
const code = apiData.code
|
||||
// 如果没有 code, 代表这不是项目后端开发的 api
|
||||
|
@ -5,7 +5,7 @@ export const isArray = (arg: unknown) => {
|
||||
|
||||
/** 判断是否为字符串 */
|
||||
export const isString = (str: unknown) => {
|
||||
return typeof str === "string" || str instanceof String || false
|
||||
return typeof str === "string" || str instanceof String
|
||||
}
|
||||
|
||||
/** 判断是否为外链 */
|
||||
|
Loading…
x
Reference in New Issue
Block a user