@yeeyoon/library 3.5.1 → 3.5.2
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/components/Header/index.jsx +5 -1
- package/lib/utils/request.js +38 -31
- package/package.json +1 -1
- package/src/global.css +1 -1
@@ -134,7 +134,11 @@ const Header = (props) => {
|
|
134
134
|
|
135
135
|
const backToIam = () => {
|
136
136
|
const { origin, pathname } = window.location;
|
137
|
-
|
137
|
+
if (origin.indexOf('huashan') > -1) {
|
138
|
+
window.location.href = 'https://testing-huashan-login.yeeyoon.com/login';
|
139
|
+
} else {
|
140
|
+
window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
|
141
|
+
}
|
138
142
|
};
|
139
143
|
|
140
144
|
// eslint-disable-next-line no-unused-vars
|
package/lib/utils/request.js
CHANGED
@@ -44,7 +44,11 @@ rest && ls.set(REST_KEY, JSON.stringify(rest));
|
|
44
44
|
|
45
45
|
const backToIam = () => {
|
46
46
|
const { origin, pathname } = window.location;
|
47
|
-
|
47
|
+
if (origin.indexOf('huashan') > -1) {
|
48
|
+
window.location.href = 'https://testing-huashan-login.yeeyoon.com/login';
|
49
|
+
} else {
|
50
|
+
window.location.href = `${HOST_IAM}?redirect=${origin}${pathname}`;
|
51
|
+
}
|
48
52
|
};
|
49
53
|
|
50
54
|
const errorHandler = (error) => {
|
@@ -78,36 +82,39 @@ const request = extend({
|
|
78
82
|
},
|
79
83
|
});
|
80
84
|
|
81
|
-
request.interceptors.response.use(
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
const m = msg || message || errormsg;
|
88
|
-
if (code !== 200 && code !== 201 && !success) {
|
89
|
-
m !== '操作过于频繁' &&
|
90
|
-
m.indexOf('存在重复的物资') < 0 &&
|
91
|
-
notification.error({
|
92
|
-
message: m,
|
93
|
-
maxCount: 1,
|
94
|
-
});
|
95
|
-
if (
|
96
|
-
code === 401 ||
|
97
|
-
code === 402 ||
|
98
|
-
m === 'token验证失败' ||
|
99
|
-
m === 'token不一致'
|
100
|
-
) {
|
101
|
-
window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
|
102
|
-
setTimeout(() => {
|
103
|
-
backToIam();
|
104
|
-
}, 1000);
|
85
|
+
request.interceptors.response.use(
|
86
|
+
async (response) => {
|
87
|
+
const resp = await response.clone().json();
|
88
|
+
const { data, code, message, msg, errormsg, success } = resp;
|
89
|
+
if (!data && !code && !message && !msg && !errormsg && !success) {
|
90
|
+
return response;
|
105
91
|
}
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
92
|
+
const m = msg || message || errormsg;
|
93
|
+
if (code !== 200 && code !== 201 && !success) {
|
94
|
+
m !== '操作过于频繁' &&
|
95
|
+
m.indexOf('存在重复的物资') < 0 &&
|
96
|
+
notification.error({
|
97
|
+
message: m,
|
98
|
+
maxCount: 1,
|
99
|
+
});
|
100
|
+
if (
|
101
|
+
code === 401 ||
|
102
|
+
code === 402 ||
|
103
|
+
m === 'token验证失败' ||
|
104
|
+
m === 'token不一致'
|
105
|
+
) {
|
106
|
+
window.top.postMessage('tcTokenExpired', '*'); // 通知宿主窗口
|
107
|
+
setTimeout(() => {
|
108
|
+
backToIam();
|
109
|
+
}, 1000);
|
110
|
+
}
|
111
|
+
return resp;
|
112
|
+
} else if (success && (!code || code === 200)) {
|
113
|
+
return resp;
|
114
|
+
}
|
115
|
+
return data;
|
116
|
+
},
|
117
|
+
{ global: false }
|
118
|
+
);
|
112
119
|
|
113
120
|
export default request;
|
package/package.json
CHANGED