|
|
@@ -143,7 +143,8 @@ Rs.interceptors.response.use(
|
|
|
const code = res.data.code || HttpStatus.SUCCESS
|
|
|
const data = res.data
|
|
|
// 获取错误信息
|
|
|
- const msg = errorCode[code] || res.data.msg || errorCode.default
|
|
|
+ let msg = errorCode[code] || res.data.msg || errorCode.default
|
|
|
+
|
|
|
// 二进制数据则直接返回
|
|
|
if (res.request.responseType === "blob" || res.request.responseType === "arraybuffer") {
|
|
|
return data
|
|
|
@@ -159,9 +160,7 @@ Rs.interceptors.response.use(
|
|
|
})
|
|
|
.then(() => {
|
|
|
isReLogin.show = false
|
|
|
- appStore.authStore.logout().then(() => {
|
|
|
- location.href = import.meta.env.VITE_APP_CONTEXT_PATH + "home"
|
|
|
- })
|
|
|
+ appStore.authStore.logout()
|
|
|
})
|
|
|
.catch(() => {
|
|
|
isReLogin.show = false
|
|
|
@@ -172,8 +171,11 @@ Rs.interceptors.response.use(
|
|
|
if (config.errorAlert) {
|
|
|
msgUtil.msgError("没有权限,请联系管理员!")
|
|
|
}
|
|
|
- return Promise.reject(msg)
|
|
|
+ return Promise.reject("没有权限,请联系管理员!")
|
|
|
} else if (code === HttpStatus.SERVER_ERROR) {
|
|
|
+ if (!import.meta.env.DEV) {
|
|
|
+ msg = "服务器异常,请联系管理员!"
|
|
|
+ }
|
|
|
if (config.errorAlert) {
|
|
|
msgUtil.msgError(msg)
|
|
|
}
|