@stemy/ngx-utils 13.2.2 → 13.2.4

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.
@@ -1362,7 +1362,7 @@ class StateService extends BehaviorSubject {
1362
1362
  return;
1363
1363
  const routerStateSnapshot = this.router.routerState.snapshot;
1364
1364
  let snapshot = routerStateSnapshot.root;
1365
- let context = this.contexts.getContext("primary");
1365
+ let context = this.contexts?.getContext("primary");
1366
1366
  let segments = snapshot.url;
1367
1367
  const components = [];
1368
1368
  const snapshots = [];
@@ -2411,15 +2411,16 @@ class BaseHttpService {
2411
2411
  }
2412
2412
  const headers = options.headers;
2413
2413
  const authKey = "Authorization";
2414
- // If an authorization header exists and we still have an Unauthorized response prompt the user to log in again
2414
+ // If an authorization header exists, and we still have an Unauthorized response prompt the user to log in again
2415
2415
  if (headers.has(authKey) && response.status == 401) {
2416
2416
  const pushed = this.pushFailedRequest(url, options, () => {
2417
2417
  options.headers = this.makeHeaders(options.originalHeaders);
2418
2418
  this.toPromise(url, options, listener).then(resolve, reject);
2419
2419
  });
2420
- if (pushed)
2420
+ if (pushed) {
2421
2421
  this.handleUnauthorizedError(absoluteUrl, options, () => reject(response));
2422
- return;
2422
+ return;
2423
+ }
2423
2424
  }
2424
2425
  reject(response);
2425
2426
  });
@@ -2427,7 +2428,7 @@ class BaseHttpService {
2427
2428
  });
2428
2429
  }
2429
2430
  pushFailedRequest(url, options, req) {
2430
- if (url.indexOf("tokens") >= 0)
2431
+ if (url.indexOf("token") >= 0 || url === "user")
2431
2432
  return false;
2432
2433
  BaseHttpService.failedRequests.push(req);
2433
2434
  return true;