@@ -13,7 +13,6 @@ import { deepMerge, setObjToUrlParams } from "/@/utils";
13
13
import { useErrorLogStoreWithOut } from "/@/store/modules/ErrorLog" ;
14
14
import { useI18n } from "/@/hooks/web/UseI18n" ;
15
15
import { formatRequestDate , joinTimestamp , messageTips } from "./Helper" ;
16
- import { useUserStoreWithOut } from "/@/store/modules/User" ;
17
16
import { AxiosRetry } from "/@/utils/http/axios/AxiosRetry" ;
18
17
19
18
const globSetting = useGlobSetting ( ) ;
@@ -42,8 +41,8 @@ const transform: AxiosTransform = {
42
41
// 抛出请求异常
43
42
throw new Error ( t ( "sys.api.apiRequestFailed" ) ) ;
44
43
}
45
- let { code , msg } = data ;
46
- const hasSuccess = data && code === ResultEnum . SUCCESS ;
44
+ let { msg } = data ;
45
+ const hasSuccess = data && data . code === ResultEnum . SUCCESS ;
47
46
if ( hasSuccess ) {
48
47
if ( msg === null || msg === undefined || msg === "" ) {
49
48
msg = t ( "sys.api.operationSuccess" ) ;
@@ -54,16 +53,6 @@ const transform: AxiosTransform = {
54
53
}
55
54
return data . data ;
56
55
}
57
- // 在此处根据自己项目的实际情况对不同的code执行不同的操作
58
- // 如果不希望中断当前请求,请return数据,否则直接抛出异常即可
59
- switch ( code ) {
60
- case ResultEnum . TIMEOUT :
61
- msg = t ( "sys.api.timeoutMessage" ) ;
62
- const userStore = useUserStoreWithOut ( ) ;
63
- userStore . setToken ( undefined ) ;
64
- userStore . logout ( ) . then ( ) ;
65
- break ;
66
- }
67
56
// errorMessageMode=‘modal’的时候会显示modal错误弹窗,而不是消息提示,用于一些比较重要的错误
68
57
// errorMessageMode='none' 一般是调用时明确表示不希望自动弹出错误提示
69
58
messageTips ( options . errorMessageMode , msg , true , 0 ) ;
0 commit comments