byt-ui 0.1.12 → 0.1.13
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/byt-ui.common.js +19 -7
- package/lib/byt-ui.umd.js +19 -7
- package/lib/byt-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/common/modules/request.js +17 -7
package/package.json
CHANGED
|
@@ -79,12 +79,20 @@ class Request {
|
|
|
79
79
|
}, error => {
|
|
80
80
|
if (error.response) {
|
|
81
81
|
const status = error.response.status
|
|
82
|
+
const message = error.response.data.msg;
|
|
82
83
|
switch (status) {
|
|
83
|
-
case
|
|
84
|
-
|
|
84
|
+
case 424:
|
|
85
|
+
case 428:
|
|
86
|
+
// 后台定义 424||428 针对令牌过期的特殊响应码
|
|
87
|
+
this.handler.expire && this.handler.expire(error.response);
|
|
88
|
+
Message.error(message);
|
|
89
|
+
if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
|
|
90
|
+
const { outLogin } = this._Vue.prototype.$appCommon;
|
|
91
|
+
outLogin && outLogin();
|
|
92
|
+
}
|
|
85
93
|
break;
|
|
86
|
-
|
|
87
|
-
|
|
94
|
+
default:
|
|
95
|
+
if (error.config.showError)Message.error(message)
|
|
88
96
|
break;
|
|
89
97
|
}
|
|
90
98
|
this.handler.error && this.handler.error(error.response);
|
|
@@ -109,7 +117,8 @@ class Request {
|
|
|
109
117
|
params = {},
|
|
110
118
|
responseType = 'json',
|
|
111
119
|
headers = {},
|
|
112
|
-
retry = 0
|
|
120
|
+
retry = 0,
|
|
121
|
+
showError
|
|
113
122
|
}) => {
|
|
114
123
|
return new Promise((resolve, reject) => {
|
|
115
124
|
this.request({
|
|
@@ -128,7 +137,7 @@ class Request {
|
|
|
128
137
|
) {
|
|
129
138
|
resolve(res)
|
|
130
139
|
} else {
|
|
131
|
-
Message.error(res.msg)
|
|
140
|
+
if (showError)Message.error(res.msg)
|
|
132
141
|
reject(res)
|
|
133
142
|
}
|
|
134
143
|
}).catch(err => {
|
|
@@ -141,7 +150,8 @@ class Request {
|
|
|
141
150
|
params,
|
|
142
151
|
responseType,
|
|
143
152
|
headers,
|
|
144
|
-
retry: retry - 1
|
|
153
|
+
retry: retry - 1,
|
|
154
|
+
showError
|
|
145
155
|
})
|
|
146
156
|
}
|
|
147
157
|
})
|