@fairys/taro-tools-react 1.0.10 → 1.0.11

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.
@@ -46,8 +46,12 @@ export interface RequestInstanceCreateOptions {
46
46
  pathRewrite: Record<string, string>;
47
47
  }>;
48
48
  };
49
+ /**启用token校验*/
50
+ isEnableTokenAuth?: boolean;
49
51
  }
50
52
  export declare class RequestInstance {
53
+ /**启用token校验*/
54
+ isEnableTokenAuth?: boolean;
51
55
  /**请求IP地址*/
52
56
  IP?: string | ((url: string, module?: string, env?: string) => string);
53
57
  /**简单的代理配置*/
@@ -41,6 +41,7 @@ const requestResponseHandle = (result, options)=>{
41
41
  });
42
42
  };
43
43
  class RequestInstance {
44
+ isEnableTokenAuth = true;
44
45
  IP;
45
46
  proxy;
46
47
  commonOptions = {};
@@ -58,6 +59,7 @@ class RequestInstance {
58
59
  ...this.commonOptions,
59
60
  ...options.commonOptions
60
61
  };
62
+ this.isEnableTokenAuth = options.isEnableTokenAuth || true;
61
63
  return this;
62
64
  };
63
65
  getHttpPath = (url, module)=>{
@@ -115,7 +117,7 @@ class RequestInstance {
115
117
  ...header
116
118
  };
117
119
  if (token) newHeader[globalSettingDataInstance.store.headerTokenName || 'token'] = token;
118
- else if (true !== isIgnoreToken) {
120
+ else if (true !== isIgnoreToken && this.isEnableTokenAuth) {
119
121
  if (false !== isShowErrorMessage) if (globalSettingDataInstance.store.isUseTaroToast) taro.showToast({
120
122
  title: "\u672A\u767B\u5F55",
121
123
  duration: 3000,
@@ -46,8 +46,12 @@ export interface RequestInstanceCreateOptions {
46
46
  pathRewrite: Record<string, string>;
47
47
  }>;
48
48
  };
49
+ /**启用token校验*/
50
+ isEnableTokenAuth?: boolean;
49
51
  }
50
52
  export declare class RequestInstance {
53
+ /**启用token校验*/
54
+ isEnableTokenAuth?: boolean;
51
55
  /**请求IP地址*/
52
56
  IP?: string | ((url: string, module?: string, env?: string) => string);
53
57
  /**简单的代理配置*/
@@ -81,6 +81,7 @@ const requestResponseHandle = (result, options)=>{
81
81
  });
82
82
  };
83
83
  class RequestInstance {
84
+ isEnableTokenAuth = true;
84
85
  IP;
85
86
  proxy;
86
87
  commonOptions = {};
@@ -98,6 +99,7 @@ class RequestInstance {
98
99
  ...this.commonOptions,
99
100
  ...options.commonOptions
100
101
  };
102
+ this.isEnableTokenAuth = options.isEnableTokenAuth || true;
101
103
  return this;
102
104
  };
103
105
  getHttpPath = (url, module)=>{
@@ -155,7 +157,7 @@ class RequestInstance {
155
157
  ...header
156
158
  };
157
159
  if (token) newHeader[global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.headerTokenName || 'token'] = token;
158
- else if (true !== isIgnoreToken) {
160
+ else if (true !== isIgnoreToken && this.isEnableTokenAuth) {
159
161
  if (false !== isShowErrorMessage) if (global_setting_data_instance_js_namespaceObject.globalSettingDataInstance.store.isUseTaroToast) taro_default().showToast({
160
162
  title: "\u672A\u767B\u5F55",
161
163
  duration: 3000,
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "author": "SunLxy <1011771396@qq.com>",
4
4
  "description": "框架组件库",
5
5
  "homepage": "https://github.com/autumn-fairy-tales/fairys-taro-react",
6
- "version": "1.0.10",
6
+ "version": "1.0.11",
7
7
  "main": "esm/index.js",
8
8
  "types": "esm/index.d.ts",
9
9
  "module": "esm/index.js",
@@ -102,9 +102,14 @@ export interface RequestInstanceCreateOptions {
102
102
  dev: Record<string, string | { target: string; pathRewrite: Record<string, string> }>;
103
103
  pro: Record<string, string | { target: string; pathRewrite: Record<string, string> }>;
104
104
  };
105
+ /**启用token校验*/
106
+ isEnableTokenAuth?: boolean;
105
107
  }
106
108
 
107
109
  export class RequestInstance {
110
+ /**启用token校验*/
111
+ public isEnableTokenAuth?: boolean = true;
112
+
108
113
  /**请求IP地址*/
109
114
  public IP?: string | ((url: string, module?: string, env?: string) => string);
110
115
  /**简单的代理配置*/
@@ -128,6 +133,7 @@ export class RequestInstance {
128
133
  this.IP = options.IP || this.IP;
129
134
  this.proxy = options.proxy || this.proxy;
130
135
  this.commonOptions = { ...this.commonOptions, ...options.commonOptions };
136
+ this.isEnableTokenAuth = options.isEnableTokenAuth || true;
131
137
  return this;
132
138
  };
133
139
 
@@ -213,7 +219,7 @@ export class RequestInstance {
213
219
  if (token) {
214
220
  newHeader[globalSettingDataInstance.store.headerTokenName || 'token'] = token;
215
221
  } else {
216
- if (isIgnoreToken !== true) {
222
+ if (isIgnoreToken !== true && this.isEnableTokenAuth) {
217
223
  // 跳转登录页
218
224
  if (isShowErrorMessage !== false) {
219
225
  if (globalSettingDataInstance.store.isUseTaroToast) {