@cpzxrobot/sdk 1.0.29 → 1.0.31

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
@@ -214,18 +214,17 @@ class Cpzxrobot {
214
214
  return;
215
215
  }
216
216
  else if (this.mode === "miniapp_in_web") {
217
- //if url has token
218
- const url = new URL(window.location.href);
219
- const token = url.searchParams.get("token");
217
+ //if localstorage has token, use it
218
+ const token = localStorage.getItem("token");
220
219
  if (token) {
221
- this.token = "Bearer " + token;
220
+ this.token = token;
222
221
  this.initAxios(baseURL);
223
222
  this.resolveReady(this.axios);
224
223
  return;
225
224
  }
226
225
  else {
227
226
  //jump to miniapp login page
228
- window.location.href = "https:///login";
227
+ window.location.href = "/login.html";
229
228
  }
230
229
  }
231
230
  else {
package/index.ts CHANGED
@@ -249,17 +249,16 @@ export class Cpzxrobot {
249
249
  });
250
250
  return;
251
251
  } else if (this.mode === "miniapp_in_web") {
252
- //if url has token
253
- const url = new URL(window.location.href);
254
- const token = url.searchParams.get("token");
252
+ //if localstorage has token, use it
253
+ const token = localStorage.getItem("token");
255
254
  if (token) {
256
- this.token = "Bearer " + token;
255
+ this.token = token;
257
256
  this.initAxios(baseURL);
258
257
  this.resolveReady(this.axios);
259
258
  return;
260
259
  } else {
261
260
  //jump to miniapp login page
262
- window.location.href = "https:///login";
261
+ window.location.href = "/login.html";
263
262
  }
264
263
  } else {
265
264
  this.initAxios(baseURL);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cpzxrobot/sdk",
3
- "version": "1.0.29",
3
+ "version": "1.0.31",
4
4
  "description": "提供给上海正芯数智APP第三方H5应用使用的SDK",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {