ngx-sp-auth 4.23.4 → 4.23.5

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.
@@ -8,9 +8,9 @@ import { LogLevel, PublicClientApplication, InteractionType } from '@azure/msal-
8
8
  import { take as take$1, tap as tap$1, map as map$1, switchMap as switchMap$1 } from 'rxjs/operators';
9
9
  import * as i1$1 from '@angular/router';
10
10
  import { RouterLink, NavigationEnd, RouterOutlet } from '@angular/router';
11
- import { BehaviorSubject, map, catchError, of, finalize, shareReplay, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, lastValueFrom, from, throwError } from 'rxjs';
11
+ import { BehaviorSubject, map, catchError, of, finalize, shareReplay, defer, take, tap, firstValueFrom, Subject, Subscription, debounceTime, distinctUntilChanged, filter, switchMap, timer, lastValueFrom, from, throwError } from 'rxjs';
12
12
  import * as i3 from 'ngx-sp-infra';
13
- import { IpServiceService, Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
13
+ import { IpServiceService, GlobalLoadingService, Utils, SearchInputComponent, InfraModule, FormUtils, Usuario, RetPasswordPolicy, RetCheckPassword, CheckPasswordRecord, PasswordPolicyComponent, LibIconsComponent, ContentContainerComponent } from 'ngx-sp-infra';
14
14
  import { openDB, deleteDB } from 'idb';
15
15
  import * as i17 from '@angular/common';
16
16
  import { NgIf, CommonModule, NgClass } from '@angular/common';
@@ -522,6 +522,7 @@ class AuthStorageService {
522
522
  this._customEnvironmentService = _customEnvironmentService;
523
523
  this._router = _router;
524
524
  this._ipService = inject(IpServiceService);
525
+ this._globalLoadingService = inject(GlobalLoadingService);
525
526
  this._BASE_URL = ''; // SpInfra2LoginWS
526
527
  this._LOGOUT_BASE_URL = ''; // SpInfra2LoginWS
527
528
  this._BASE_VERIFICATION_URL = ''; // SpInfra2LoginWS
@@ -829,16 +830,19 @@ class AuthStorageService {
829
830
  verifyToken() {
830
831
  const url = `${this._BASE_VERIFICATION_URL}`;
831
832
  const headers = this._HTTP_HEADERS;
832
- const params = new HttpParams()
833
- .set('ip', this.ip)
834
- .set('browser', this._ipService.getDataBrowserUser().browser);
835
- return this._httpClient.get(url, { params, 'headers': headers, withCredentials: true })
836
- .pipe(take(1), tap(res => {
837
- if (res.Error)
838
- this.isLoggedInSub.next(false);
839
- else
840
- this.isLoggedInSub.next(true);
841
- }));
833
+ return defer(() => {
834
+ this._globalLoadingService.show(false, 'Validando token do usuário.');
835
+ const params = new HttpParams()
836
+ .set('ip', this.ip)
837
+ .set('browser', this._ipService.getDataBrowserUser().browser);
838
+ return this._httpClient.get(url, { params, 'headers': headers, withCredentials: true })
839
+ .pipe(take(1), tap(res => {
840
+ if (res.Error)
841
+ this.isLoggedInSub.next(false);
842
+ else
843
+ this.isLoggedInSub.next(true);
844
+ }));
845
+ }).pipe(finalize(() => this._globalLoadingService.hide()));
842
846
  }
843
847
  /** Verifica a cada diferença de tempo entre a data atual e a data do token. */
844
848
  // public async reCheckLogin(renew: boolean) {