byt-ui 0.1.10 → 0.1.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.
@@ -180206,9 +180206,8 @@ class request_Request {
180206
180206
  if (token && !isToken) {
180207
180207
  config.headers['Authorization'] = `Bearer ${token}`; // token
180208
180208
  }
180209
- if (TENANT_ID) {
180210
- config.headers['TENANT-ID'] = TENANT_ID; // 租户ID
180211
- }
180209
+ config.headers['TENANT-ID'] = TENANT_ID || this.getQueryString('TENANT-ID') || ''; // 租户ID
180210
+
180212
180211
  return config;
180213
180212
  }, error => {
180214
180213
  return Promise.reject(error);
@@ -180258,6 +180257,14 @@ class request_Request {
180258
180257
  return Promise.reject(new Error(error));
180259
180258
  });
180260
180259
  }
180260
+ getQueryString(name) {
180261
+ const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
180262
+ const r = window.location.search.substr(1).match(reg);
180263
+ if (r != null) {
180264
+ return decodeURIComponent(r[2]);
180265
+ }
180266
+ return null;
180267
+ }
180261
180268
  setMethods() {
180262
180269
  this._methods.forEach(v => {
180263
180270
  this.request[v] = ({
package/lib/byt-ui.umd.js CHANGED
@@ -180216,9 +180216,8 @@ class request_Request {
180216
180216
  if (token && !isToken) {
180217
180217
  config.headers['Authorization'] = `Bearer ${token}`; // token
180218
180218
  }
180219
- if (TENANT_ID) {
180220
- config.headers['TENANT-ID'] = TENANT_ID; // 租户ID
180221
- }
180219
+ config.headers['TENANT-ID'] = TENANT_ID || this.getQueryString('TENANT-ID') || ''; // 租户ID
180220
+
180222
180221
  return config;
180223
180222
  }, error => {
180224
180223
  return Promise.reject(error);
@@ -180268,6 +180267,14 @@ class request_Request {
180268
180267
  return Promise.reject(new Error(error));
180269
180268
  });
180270
180269
  }
180270
+ getQueryString(name) {
180271
+ const reg = new RegExp(`(^|&)${name}=([^&]*)(&|$)`, 'i');
180272
+ const r = window.location.search.substr(1).match(reg);
180273
+ if (r != null) {
180274
+ return decodeURIComponent(r[2]);
180275
+ }
180276
+ return null;
180277
+ }
180271
180278
  setMethods() {
180272
180279
  this._methods.forEach(v => {
180273
180280
  this.request[v] = ({