byt-ui 0.1.13 → 0.1.14
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 +18 -41
- package/lib/byt-ui.umd.js +18 -41
- package/lib/byt-ui.umd.min.js +1 -1
- package/package.json +1 -1
- package/packages/common/modules/request.js +17 -37
package/package.json
CHANGED
|
@@ -54,47 +54,27 @@ class Request {
|
|
|
54
54
|
this.request.interceptors.response.use(res => {
|
|
55
55
|
const status = Number(res.status) || 200
|
|
56
56
|
const message = res.data.msg || this._errorCode[status] || this._errorCode['default']
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
Message.error(message);
|
|
70
|
-
if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
|
|
71
|
-
const { outLogin } = this._Vue.prototype.$appCommon;
|
|
72
|
-
outLogin && outLogin();
|
|
73
|
-
}
|
|
74
|
-
break;
|
|
75
|
-
default:
|
|
76
|
-
Message.error(message);
|
|
77
|
-
return Promise.reject(message)
|
|
57
|
+
if (status == 424 || status == 428) {
|
|
58
|
+
// 后台定义 424||428 针对令牌过期的特殊响应码
|
|
59
|
+
this.handler.expire && this.handler.expire(res.data);
|
|
60
|
+
if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
|
|
61
|
+
const { outLogin } = this._Vue.prototype.$appCommon;
|
|
62
|
+
outLogin && outLogin();
|
|
63
|
+
}
|
|
64
|
+
return res.data
|
|
65
|
+
}
|
|
66
|
+
if (status !== 200 || res.data.code === 1) {
|
|
67
|
+
if (res.config.showError) Message.error(message)
|
|
68
|
+
return Promise.reject(res.data)
|
|
78
69
|
}
|
|
70
|
+
|
|
71
|
+
this.handler.success && this.handler.success(res.data);
|
|
72
|
+
return res.data
|
|
79
73
|
}, error => {
|
|
80
74
|
if (error.response) {
|
|
81
|
-
const status = error.response.status
|
|
75
|
+
// const status = error.response.status
|
|
82
76
|
const message = error.response.data.msg;
|
|
83
|
-
|
|
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
|
-
}
|
|
93
|
-
break;
|
|
94
|
-
default:
|
|
95
|
-
if (error.config.showError)Message.error(message)
|
|
96
|
-
break;
|
|
97
|
-
}
|
|
77
|
+
if (error.config.showError)Message.error(message)
|
|
98
78
|
this.handler.error && this.handler.error(error.response);
|
|
99
79
|
}
|
|
100
80
|
return Promise.reject(new Error(error))
|