fix: 修改不返回 code 导致的问题

This commit is contained in:
奔跑的面条 2023-04-23 21:05:52 +08:00
parent 2a8d0717f8
commit a400526108
3 changed files with 3 additions and 3 deletions

View File

@ -21,7 +21,7 @@ axiosInstance.interceptors.request.use(
axiosInstance.interceptors.response.use(
(res: AxiosResponse) => {
const { code } = res.data as { code: number }
if (code === undefined || code === null) return Promise.resolve(res)
if (code === undefined || code === null) return Promise.resolve(res.data)
if (code === ResultEnum.DATA_SUCCESS) return Promise.resolve(res.data)
// 重定向
if (ErrorPageNameMap.get(code)) redirectErrorPage(code)

View File

@ -132,7 +132,7 @@ const sendHandle = async () => {
if (res) {
const { data } = res
if (!data && !targetData.value.filter) window['$message'].warning('您的数据不符合默认格式,请配置过滤器!')
targetData.value.option.dataset = newFunctionHandle(data.data, data, targetData.value.filter)
targetData.value.option.dataset = newFunctionHandle(data, res, targetData.value.filter)
showMatching.value = true
return
}

View File

@ -129,7 +129,7 @@ const fetchTargetData = async () => {
try {
const res = await customizeHttp(toRaw(targetData.value.request), toRaw(chartEditStore.getRequestGlobalConfig))
if (res) {
sourceData.value = res.data
sourceData.value = res
return
}
window['$message'].warning('没有拿到返回值,请检查接口!')