yuang-framework-ui-common 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/config/httpConfig.ts +8 -1
- package/package.json +1 -1
package/lib/config/httpConfig.ts
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
import axios from "axios"
|
2
|
+
import { useRouter } from 'vue-router';
|
3
|
+
|
2
4
|
import type { AxiosResponse } from 'axios';
|
3
5
|
|
4
6
|
import { showErrorMessage } from '../utils/messageUtils';
|
@@ -10,6 +12,8 @@ import { clearGatewayConfig, initGatewayConfig, getGatewayConfigUrl } from '../c
|
|
10
12
|
|
11
13
|
import { getLocalStorageItem } from '../utils/storageUtils'
|
12
14
|
|
15
|
+
const router = useRouter();
|
16
|
+
|
13
17
|
const messageMap = {
|
14
18
|
requestError: '请求异常',
|
15
19
|
responseSturctError: '响应结构错误',
|
@@ -72,11 +76,14 @@ http.interceptors.response.use(async (res: any) => {
|
|
72
76
|
await refreshSsoAccessToken(res);
|
73
77
|
// 重发请求
|
74
78
|
return axios.request(res.config);
|
79
|
+
} else if (res?.data?.statusCode === 815004) {
|
80
|
+
const fullPath = router.currentRoute.value.fullPath;
|
81
|
+
router.push(`/sso/login/index?redirectRoutePath=${fullPath}`);
|
82
|
+
return;
|
75
83
|
} else if (res?.data?.statusCode === 815003) {
|
76
84
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
77
85
|
return Promise.reject(new Error(res?.data?.message));
|
78
86
|
}
|
79
|
-
|
80
87
|
showErrorMessage(res?.data?.message || messageMap.requestError);
|
81
88
|
return Promise.reject(new Error(res?.data?.message));
|
82
89
|
}
|