diff --git a/src/modules/app/browser-app.config.ts b/src/modules/app/browser-app.config.ts index 48de49fe7e..7659edf94c 100644 --- a/src/modules/app/browser-app.config.ts +++ b/src/modules/app/browser-app.config.ts @@ -3,12 +3,9 @@ import { provideHttpClient, withInterceptorsFromDi, } from '@angular/common/http'; -import { - APP_INITIALIZER, - NgModule, -} from '@angular/core'; import { APP_ID, + APP_INITIALIZER, ApplicationConfig, importProvidersFrom, makeStateKey, @@ -53,10 +50,10 @@ import { ClientCookieService } from '../../app/core/services/client-cookie.servi import { CookieService } from '../../app/core/services/cookie.service'; import { HardRedirectService } from '../../app/core/services/hard-redirect.service'; import { ReferrerService } from '../../app/core/services/referrer.service'; -import { BrowserXSRFService } from '../../app/core/xsrf/browser-xsrf.service'; -import { XSRFService } from '../../app/core/xsrf/xsrf.service'; import { ClientMathService } from '../../app/core/shared/client-math.service'; import { MathService } from '../../app/core/shared/math.service'; +import { BrowserXSRFService } from '../../app/core/xsrf/browser-xsrf.service'; +import { XSRFService } from '../../app/core/xsrf/xsrf.service'; import { BrowserKlaroService } from '../../app/shared/cookies/browser-klaro.service'; import { KlaroService } from '../../app/shared/cookies/klaro.service'; import { MissingTranslationHelper } from '../../app/shared/translate/missing-translation.helper'; diff --git a/src/modules/app/browser-init.service.ts b/src/modules/app/browser-init.service.ts index 1ba80a4ba3..799910efc6 100644 --- a/src/modules/app/browser-init.service.ts +++ b/src/modules/app/browser-init.service.ts @@ -18,6 +18,7 @@ import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; import { firstValueFrom, + lastValueFrom, Subscription, } from 'rxjs'; import { @@ -124,7 +125,7 @@ export class BrowserInitService extends InitService { this.initKlaro(); - await this.authenticationReady$().toPromise(); + await lastValueFrom(this.authenticationReady$()); return true; }; @@ -141,10 +142,12 @@ export class BrowserInitService extends InitService { const state = this.transferState.get(InitService.NGRX_STATE, null); this.transferState.remove(InitService.NGRX_STATE); this.store.dispatch(new StoreAction(StoreActionTypes.REHYDRATE, state)); - return this.store.select(coreSelector).pipe( - find((core: any) => isNotEmpty(core)), - map(() => true), - ).toPromise(); + return lastValueFrom( + this.store.select(coreSelector).pipe( + find((core: any) => isNotEmpty(core)), + map(() => true), + ), + ); } private trackAuthTokenExpiration(): void { @@ -190,7 +193,7 @@ export class BrowserInitService extends InitService { * @private */ private closeAuthCheckSubscription() { - firstValueFrom(this.authenticationReady$()).then(() => { + void firstValueFrom(this.authenticationReady$()).then(() => { this.sub.unsubscribe(); }); } diff --git a/src/modules/app/server-init.service.ts b/src/modules/app/server-init.service.ts index 8849e8f00e..6db4f4a48b 100644 --- a/src/modules/app/server-init.service.ts +++ b/src/modules/app/server-init.service.ts @@ -8,10 +8,11 @@ import { Inject, Injectable, + TransferState, } from '@angular/core'; -import { TransferState } from '@angular/platform-browser'; import { Store } from '@ngrx/store'; import { TranslateService } from '@ngx-translate/core'; +import { lastValueFrom } from 'rxjs'; import { take } from 'rxjs/operators'; import { AppState } from '../../app/app.reducer'; @@ -75,7 +76,7 @@ export class ServerInitService extends InitService { this.initRouteListeners(); this.themeService.listenForThemeChanges(false); - await this.authenticationReady$().toPromise(); + await lastValueFrom(this.authenticationReady$()); return true; };