@yeeyoon/library 2.9.6 → 3.0.1

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.
@@ -163,11 +163,11 @@ const Header = (props) => {
163
163
  setAvatarProps({ src: data.headUrl || DEFAULT_AVATAR_URL });
164
164
  currentProduct = tenants[0].applications || [];
165
165
  getProductList(id);
166
- } else {
166
+ } /*else {
167
167
  setTimeout(() => {
168
168
  backToIam();
169
169
  }, 4500);
170
- }
170
+ }*/
171
171
  };
172
172
 
173
173
  const getProductList = async (userId) => {
@@ -4,6 +4,8 @@ import qs from 'qs';
4
4
  import ls from 'local-storage';
5
5
  import { notification } from 'antd';
6
6
 
7
+ import { HOST_IAM } from '../config/env';
8
+
7
9
  const TOKEN_KEY = 'X-Auth-Token';
8
10
  const ID_KEY = 'X-Auth-Id';
9
11
  const REST_KEY = 'Login-Rest-Info';
@@ -40,6 +42,11 @@ rest && ls.set(REST_KEY, JSON.stringify(rest));
40
42
  // };
41
43
  /** 异常处理程序 */
42
44
 
45
+ const backToIam = () => {
46
+ const { origin, pathname } = window.location;
47
+ window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
48
+ };
49
+
43
50
  const errorHandler = (error) => {
44
51
  const { response } = error;
45
52
 
@@ -78,7 +85,10 @@ request.interceptors.response.use(async (response) => {
78
85
  if (code !== 200 && code !== 201 && !success) {
79
86
  m !== '操作过于频繁' &&
80
87
  m.indexOf('存在重复的物资') < 0 &&
81
- notification.error({ message: m });
88
+ notification.error({
89
+ message: m,
90
+ maxCount: 1,
91
+ });
82
92
  if (
83
93
  code === 401 ||
84
94
  code === 402 ||
@@ -86,6 +96,9 @@ request.interceptors.response.use(async (response) => {
86
96
  m === 'token不一致'
87
97
  ) {
88
98
  window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
99
+ setTimeout(() => {
100
+ backToIam();
101
+ }, 1000);
89
102
  }
90
103
  return resp;
91
104
  } else if (success && (!code || code === 200)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeeyoon/library",
3
- "version": "2.9.6",
3
+ "version": "3.0.1",
4
4
  "description": "宜云前端组件库和通用服务",
5
5
  "main": "index.js",
6
6
  "repository": {