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.
@@ -180242,51 +180242,28 @@ class request_Request {
180242
180242
  this.request.interceptors.response.use(res => {
180243
180243
  const status = Number(res.status) || 200;
180244
180244
  const message = res.data.msg || this._errorCode[status] || this._errorCode['default'];
180245
- switch (status * 1) {
180246
- case 200:
180247
- if (res.data.code === 1) {
180248
- element_ui_common.Message.error(message);
180249
- return Promise.reject(res.data);
180250
- }
180251
- this.handler.success && this.handler.success(res.data);
180252
- return res.data;
180253
- case 424:
180254
- case 428:
180255
- // 后台定义 424||428 针对令牌过期的特殊响应码
180256
- this.handler.expire && this.handler.expire(res.data);
180257
- element_ui_common.Message.error(message);
180258
- if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180259
- const {
180260
- outLogin
180261
- } = this._Vue.prototype.$appCommon;
180262
- outLogin && outLogin();
180263
- }
180264
- break;
180265
- default:
180266
- element_ui_common.Message.error(message);
180267
- return Promise.reject(message);
180245
+ if (status == 424 || status == 428) {
180246
+ // 后台定义 424||428 针对令牌过期的特殊响应码
180247
+ this.handler.expire && this.handler.expire(res.data);
180248
+ if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180249
+ const {
180250
+ outLogin
180251
+ } = this._Vue.prototype.$appCommon;
180252
+ outLogin && outLogin();
180253
+ }
180254
+ return res.data;
180268
180255
  }
180256
+ if (status !== 200 || res.data.code === 1) {
180257
+ if (res.config.showError) element_ui_common.Message.error(message);
180258
+ return Promise.reject(res.data);
180259
+ }
180260
+ this.handler.success && this.handler.success(res.data);
180261
+ return res.data;
180269
180262
  }, error => {
180270
180263
  if (error.response) {
180271
- const status = error.response.status;
180264
+ // const status = error.response.status
180272
180265
  const message = error.response.data.msg;
180273
- switch (status) {
180274
- case 424:
180275
- case 428:
180276
- // 后台定义 424||428 针对令牌过期的特殊响应码
180277
- this.handler.expire && this.handler.expire(error.response);
180278
- element_ui_common.Message.error(message);
180279
- if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180280
- const {
180281
- outLogin
180282
- } = this._Vue.prototype.$appCommon;
180283
- outLogin && outLogin();
180284
- }
180285
- break;
180286
- default:
180287
- if (error.config.showError) element_ui_common.Message.error(message);
180288
- break;
180289
- }
180266
+ if (error.config.showError) element_ui_common.Message.error(message);
180290
180267
  this.handler.error && this.handler.error(error.response);
180291
180268
  }
180292
180269
  return Promise.reject(new Error(error));
package/lib/byt-ui.umd.js CHANGED
@@ -180252,51 +180252,28 @@ class request_Request {
180252
180252
  this.request.interceptors.response.use(res => {
180253
180253
  const status = Number(res.status) || 200;
180254
180254
  const message = res.data.msg || this._errorCode[status] || this._errorCode['default'];
180255
- switch (status * 1) {
180256
- case 200:
180257
- if (res.data.code === 1) {
180258
- element_ui_common.Message.error(message);
180259
- return Promise.reject(res.data);
180260
- }
180261
- this.handler.success && this.handler.success(res.data);
180262
- return res.data;
180263
- case 424:
180264
- case 428:
180265
- // 后台定义 424||428 针对令牌过期的特殊响应码
180266
- this.handler.expire && this.handler.expire(res.data);
180267
- element_ui_common.Message.error(message);
180268
- if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180269
- const {
180270
- outLogin
180271
- } = this._Vue.prototype.$appCommon;
180272
- outLogin && outLogin();
180273
- }
180274
- break;
180275
- default:
180276
- element_ui_common.Message.error(message);
180277
- return Promise.reject(message);
180255
+ if (status == 424 || status == 428) {
180256
+ // 后台定义 424||428 针对令牌过期的特殊响应码
180257
+ this.handler.expire && this.handler.expire(res.data);
180258
+ if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180259
+ const {
180260
+ outLogin
180261
+ } = this._Vue.prototype.$appCommon;
180262
+ outLogin && outLogin();
180263
+ }
180264
+ return res.data;
180278
180265
  }
180266
+ if (status !== 200 || res.data.code === 1) {
180267
+ if (res.config.showError) element_ui_common.Message.error(message);
180268
+ return Promise.reject(res.data);
180269
+ }
180270
+ this.handler.success && this.handler.success(res.data);
180271
+ return res.data;
180279
180272
  }, error => {
180280
180273
  if (error.response) {
180281
- const status = error.response.status;
180274
+ // const status = error.response.status
180282
180275
  const message = error.response.data.msg;
180283
- switch (status) {
180284
- case 424:
180285
- case 428:
180286
- // 后台定义 424||428 针对令牌过期的特殊响应码
180287
- this.handler.expire && this.handler.expire(error.response);
180288
- element_ui_common.Message.error(message);
180289
- if (window.__POWERED_BY_QIANKUN__ && this._Vue) {
180290
- const {
180291
- outLogin
180292
- } = this._Vue.prototype.$appCommon;
180293
- outLogin && outLogin();
180294
- }
180295
- break;
180296
- default:
180297
- if (error.config.showError) element_ui_common.Message.error(message);
180298
- break;
180299
- }
180276
+ if (error.config.showError) element_ui_common.Message.error(message);
180300
180277
  this.handler.error && this.handler.error(error.response);
180301
180278
  }
180302
180279
  return Promise.reject(new Error(error));