From a057c6e2c00158dc5cd18115d8b395dd6776fee6 Mon Sep 17 00:00:00 2001 From: erhanilze Date: Tue, 1 Oct 2024 10:56:47 +0300 Subject: [PATCH] update : setLanguageWithUICulture method usage --- .../lib/strategies/auth-code-flow-strategy.ts | 26 ++++++++++--------- 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts b/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts index 832645ba8e..4626c91aec 100644 --- a/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts +++ b/npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts @@ -12,18 +12,7 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { return super .init() - .then(() => { - this.oAuthService.events - .pipe( - filter(event => event.type === 'token_received'), - tap(e => { - const urlParams = window.location.search; - const uiCulture = new URLSearchParams(urlParams).get('ui-culture'); - this.sessionState.setLanguage(uiCulture); - }), - ) - .subscribe(); - }) + .then(() => this.setLanguageWithUICulture()) .then(() => this.oAuthService.tryLogin().catch(noop)) .then(() => this.oAuthService.setupAutomaticSilentRefresh()); } @@ -80,4 +69,17 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy { const culture = { culture: lang, 'ui-culture': lang }; return { ...(lang && culture), ...queryParams }; } + + private setLanguageWithUICulture() { + this.oAuthService.events + .pipe( + filter(event => event.type === 'token_received'), + tap(e => { + const urlParams = window.location.search; + const uiCulture = new URLSearchParams(urlParams).get('ui-culture'); + this.sessionState.setLanguage(uiCulture); + }), + ) + .subscribe(); + } }