@evergis/api 4.1.50 → 4.1.52

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
@@ -2784,11 +2784,9 @@ class Api extends EventEmitter {
2784
2784
  http;
2785
2785
  wsUrl;
2786
2786
  urlPath;
2787
- refreshingToken;
2788
2787
  constructor({ url, wsUrl, wsKeepAlive, snappingHubUrl, http, urlPath, httpOptions, }) {
2789
2788
  super();
2790
2789
  const { hooks } = httpOptions || {};
2791
- this.refreshingToken = false;
2792
2790
  this.http =
2793
2791
  http ||
2794
2792
  new HttpClient({
@@ -2819,8 +2817,7 @@ class Api extends EventEmitter {
2819
2817
  case 401:
2820
2818
  try {
2821
2819
  const refreshToken = window.localStorage.getItem(STORAGE_REFRESH_TOKEN_KEY);
2822
- if (!this.refreshingToken && refreshToken) {
2823
- this.refreshingToken = true;
2820
+ if (refreshToken) {
2824
2821
  const refreshTokenResponse = await this.account.refreshToken({
2825
2822
  refreshToken,
2826
2823
  });
@@ -2879,6 +2876,9 @@ class Api extends EventEmitter {
2879
2876
  withCredentials: true,
2880
2877
  skipNegotiation: true,
2881
2878
  transport: signalr.HttpTransportType.WebSockets,
2879
+ accessTokenFactory: () => {
2880
+ return window.localStorage.getItem(STORAGE_TOKEN_KEY) || "";
2881
+ },
2882
2882
  })
2883
2883
  .withAutomaticReconnect()
2884
2884
  .build()