Browse Source

update : setLanguageWithUICulture method usage

pull/20935/head
erhanilze 1 year ago
parent
commit
a057c6e2c0
  1. 26
      npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts

26
npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts

@ -12,18 +12,7 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
return super return super
.init() .init()
.then(() => { .then(() => this.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();
})
.then(() => this.oAuthService.tryLogin().catch(noop)) .then(() => this.oAuthService.tryLogin().catch(noop))
.then(() => this.oAuthService.setupAutomaticSilentRefresh()); .then(() => this.oAuthService.setupAutomaticSilentRefresh());
} }
@ -80,4 +69,17 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
const culture = { culture: lang, 'ui-culture': lang }; const culture = { culture: lang, 'ui-culture': lang };
return { ...(lang && culture), ...queryParams }; 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();
}
} }

Loading…
Cancel
Save