@0xchain/request 1.1.0-beta.65 → 1.1.0-beta.67

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
@@ -1,7 +1,7 @@
1
1
  import axios, { isAxiosError, AxiosError } from "axios";
2
2
  import qs from "qs";
3
3
  import jsCookie from "js-cookie";
4
- import { envCookieName, getToken, isTokenExpired } from "@0xchain/token";
4
+ import { envCookieName, getToken, removeAllToken, isTokenExpired } from "@0xchain/token";
5
5
  import { logger } from "@0xchain/logger";
6
6
  const isSimplifiedChinese = () => {
7
7
  return /^(zh-hans|zh-cn|zh-sg|zh-my)$/.test(window?.navigator.language.toLowerCase());
@@ -228,8 +228,12 @@ function refreshAccessToken() {
228
228
  }).then((res) => {
229
229
  const data = res?.data?.data;
230
230
  if (data?.access_token) {
231
+ if (typeof window !== "undefined") {
232
+ window.dispatchEvent(new CustomEvent("user-profile-updated"));
233
+ }
231
234
  return data.access_token;
232
235
  }
236
+ removeAllToken();
233
237
  return null;
234
238
  }).catch(() => null).then((result) => {
235
239
  lastRefreshAt = Date.now();
@@ -1 +1 @@
1
- {"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA6C3D;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
1
+ {"version":3,"file":"tokenRefresh.d.ts","sourceRoot":"","sources":["../src/tokenRefresh.ts"],"names":[],"mappings":"AAqCA;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAwD3D;AAED,wBAAgB,qBAAqB,IAAI,MAAM,CAE9C"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xchain/request",
3
- "version": "1.1.0-beta.65",
3
+ "version": "1.1.0-beta.67",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -32,8 +32,8 @@
32
32
  "qs": "6.14.0"
33
33
  },
34
34
  "dependencies": {
35
- "@0xchain/token": "1.1.0-beta.65",
36
- "@0xchain/logger": "1.1.0-beta.65"
35
+ "@0xchain/logger": "1.1.0-beta.67",
36
+ "@0xchain/token": "1.1.0-beta.67"
37
37
  },
38
38
  "nx": {
39
39
  "tags": [