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