yuang-framework-ui-common 1.0.2 → 1.0.3
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/http.ts +8 -4
- package/lib/utils/gatewayUtils.ts +1 -2
- package/package.json +1 -1
package/lib/config/http.ts
CHANGED
@@ -29,12 +29,16 @@ $http.interceptors.request.use(config => {
|
|
29
29
|
/* 响应拦截器 */
|
30
30
|
$http.interceptors.response.use((res) => {
|
31
31
|
// 登录过期处理
|
32
|
-
if (res.data.statusCode
|
33
|
-
|
34
|
-
|
35
|
-
|
32
|
+
if (res.data.statusCode !== 200) {
|
33
|
+
if (res.data.statusCode === 401) {
|
34
|
+
clearSsoAccessToken();
|
35
|
+
// router.push('/sso/login');
|
36
|
+
location.href = 'http://localhost:8110/sso-ui-pc/sso/login';
|
37
|
+
return Promise.reject(new Error(res.data.message));
|
38
|
+
}
|
36
39
|
return Promise.reject(new Error(res.data.message));
|
37
40
|
}
|
41
|
+
|
38
42
|
return res;
|
39
43
|
}, (error) => {
|
40
44
|
return Promise.reject(error);
|
@@ -1,4 +1,3 @@
|
|
1
|
-
import {ElMessage} from 'element-plus/es';
|
2
1
|
|
3
2
|
import http from '../config/http';
|
4
3
|
|
@@ -8,7 +7,7 @@ const initGateway = () => {
|
|
8
7
|
if (!gatewayAccessToken) {
|
9
8
|
let res = await http.get('/server/gateway/getGatewayAccessToken');
|
10
9
|
if (res.data.statusCode != 200) {
|
11
|
-
return
|
10
|
+
return console.error(res.data.message);
|
12
11
|
}
|
13
12
|
localStorage.setItem("gatewayAccessToken", res.data.data.gatewayAccessToken);
|
14
13
|
}
|