dfws-ve-taro-request 0.1.6 → 0.1.8

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/dist/index.js CHANGED
@@ -6819,7 +6819,7 @@ var checkStatus = function (response, options, Taro) {
6819
6819
  return data;
6820
6820
  }
6821
6821
  var type = response.header['Content-Type'] || response.header['content-type'] || '';
6822
- if (typeof data.status == 'undefined' && !type.includes('text/html')) {
6822
+ if (typeof data.status == 'undefined' && (type && !type.includes('text/html'))) {
6823
6823
  data.status = 1;
6824
6824
  data.errMsg = "";
6825
6825
  }
@@ -6862,10 +6862,18 @@ var request = (function (url, data, method, header, Taro, debug) {
6862
6862
  return checkStatus(response, { url: url, data: data, method: method }, Taro);
6863
6863
  }).catch(function (err) {
6864
6864
  console.log('error:', err);
6865
- Taro.showToast({
6866
- title: '网络异常,请稍后重试',
6867
- icon: 'none',
6868
- });
6865
+ if (err && err.statusCode == 401) {
6866
+ Taro.removeStorage({ key: 'ticket' });
6867
+ Taro.removeStorage({ key: 'user_id' });
6868
+ Taro.removeStorage({ key: 'openid' });
6869
+ Taro.removeStorage({ key: 'mobile' });
6870
+ }
6871
+ else {
6872
+ Taro.showToast({
6873
+ title: '网络异常,请稍后重试',
6874
+ icon: 'none',
6875
+ });
6876
+ }
6869
6877
  return {
6870
6878
  status: 0,
6871
6879
  errMsg: '',