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.
@@ -180269,12 +180269,22 @@ class request_Request {
180269
180269
  }, error => {
180270
180270
  if (error.response) {
180271
180271
  const status = error.response.status;
180272
+ const message = error.response.data.msg;
180272
180273
  switch (status) {
180273
- case 404:
180274
- element_ui_common.Message.error(this._errorCode[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
+ }
180275
180285
  break;
180276
- case 503:
180277
- element_ui_common.Message.error(error.response.data.msg);
180286
+ default:
180287
+ if (error.config.showError) element_ui_common.Message.error(message);
180278
180288
  break;
180279
180289
  }
180280
180290
  this.handler.error && this.handler.error(error.response);
@@ -180298,7 +180308,8 @@ class request_Request {
180298
180308
  params = {},
180299
180309
  responseType = 'json',
180300
180310
  headers = {},
180301
- retry = 0
180311
+ retry = 0,
180312
+ showError
180302
180313
  }) => {
180303
180314
  return new Promise((resolve, reject) => {
180304
180315
  this.request({
@@ -180312,7 +180323,7 @@ class request_Request {
180312
180323
  if (!res.code || res.code === 0 || responseType == 'arraybuffer' || responseType == 'blob') {
180313
180324
  resolve(res);
180314
180325
  } else {
180315
- element_ui_common.Message.error(res.msg);
180326
+ if (showError) element_ui_common.Message.error(res.msg);
180316
180327
  reject(res);
180317
180328
  }
180318
180329
  }).catch(err => {
@@ -180325,7 +180336,8 @@ class request_Request {
180325
180336
  params,
180326
180337
  responseType,
180327
180338
  headers,
180328
- retry: retry - 1
180339
+ retry: retry - 1,
180340
+ showError
180329
180341
  });
180330
180342
  }
180331
180343
  });
package/lib/byt-ui.umd.js CHANGED
@@ -180279,12 +180279,22 @@ class request_Request {
180279
180279
  }, error => {
180280
180280
  if (error.response) {
180281
180281
  const status = error.response.status;
180282
+ const message = error.response.data.msg;
180282
180283
  switch (status) {
180283
- case 404:
180284
- element_ui_common.Message.error(this._errorCode[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
+ }
180285
180295
  break;
180286
- case 503:
180287
- element_ui_common.Message.error(error.response.data.msg);
180296
+ default:
180297
+ if (error.config.showError) element_ui_common.Message.error(message);
180288
180298
  break;
180289
180299
  }
180290
180300
  this.handler.error && this.handler.error(error.response);
@@ -180308,7 +180318,8 @@ class request_Request {
180308
180318
  params = {},
180309
180319
  responseType = 'json',
180310
180320
  headers = {},
180311
- retry = 0
180321
+ retry = 0,
180322
+ showError
180312
180323
  }) => {
180313
180324
  return new Promise((resolve, reject) => {
180314
180325
  this.request({
@@ -180322,7 +180333,7 @@ class request_Request {
180322
180333
  if (!res.code || res.code === 0 || responseType == 'arraybuffer' || responseType == 'blob') {
180323
180334
  resolve(res);
180324
180335
  } else {
180325
- element_ui_common.Message.error(res.msg);
180336
+ if (showError) element_ui_common.Message.error(res.msg);
180326
180337
  reject(res);
180327
180338
  }
180328
180339
  }).catch(err => {
@@ -180335,7 +180346,8 @@ class request_Request {
180335
180346
  params,
180336
180347
  responseType,
180337
180348
  headers,
180338
- retry: retry - 1
180349
+ retry: retry - 1,
180350
+ showError
180339
180351
  });
180340
180352
  }
180341
180353
  });