|
|
@ -21,6 +21,7 @@ import { joinTimestamp, formatRequestDate } from './helper'; |
|
|
|
import { Base64 } from 'js-base64'; |
|
|
|
import { Base64 } from 'js-base64'; |
|
|
|
import { AxiosRetry } from '/@/utils/http/axios/axiosRetry'; |
|
|
|
import { AxiosRetry } from '/@/utils/http/axios/axiosRetry'; |
|
|
|
import { clone } from 'lodash-es'; |
|
|
|
import { clone } from 'lodash-es'; |
|
|
|
|
|
|
|
import { useAppStoreWithOut } from '/@/store/modules/app'; |
|
|
|
|
|
|
|
|
|
|
|
const globSetting = useGlobSetting(); |
|
|
|
const globSetting = useGlobSetting(); |
|
|
|
const urlPrefix = globSetting.urlPrefix; |
|
|
|
const urlPrefix = globSetting.urlPrefix; |
|
|
@ -134,9 +135,15 @@ const transform: AxiosTransform = { |
|
|
|
const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; |
|
|
|
const errorMessageMode = config?.requestOptions?.errorMessageMode || 'none'; |
|
|
|
const err: string = response?.data?.msg?.toString?.() ?? ''; |
|
|
|
const err: string = response?.data?.msg?.toString?.() ?? ''; |
|
|
|
let errMessage = err; |
|
|
|
let errMessage = err; |
|
|
|
|
|
|
|
// 异常响应页面
|
|
|
|
|
|
|
|
const exceptionCode = response?.data?.code; |
|
|
|
|
|
|
|
if (typeof exceptionCode == 'number') { |
|
|
|
|
|
|
|
const appStore = useAppStoreWithOut(); |
|
|
|
|
|
|
|
appStore.setPageException(exceptionCode); |
|
|
|
|
|
|
|
} |
|
|
|
// 优先使用预设错误提示
|
|
|
|
// 优先使用预设错误提示
|
|
|
|
const status = error?.response?.status || 200; |
|
|
|
const status = error?.response?.status || 200; |
|
|
|
if(!checkStatus(status, errMessage, errorMessageMode)){ |
|
|
|
if(!checkStatus(status, errMessage, errorMessageMode, response)){ |
|
|
|
try { |
|
|
|
try { |
|
|
|
// 扩展预设异常处理
|
|
|
|
// 扩展预设异常处理
|
|
|
|
if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { |
|
|
|
if (code === 'ECONNABORTED' && message.indexOf('timeout') !== -1) { |
|
|
|