Browse Source

fix : set language with ui-culture on auth-code-flow

pull/20935/head
erhanilze 2 years ago
parent
commit
1f499f9125
  1. 14
      npm/ng-packs/packages/oauth/src/lib/strategies/auth-code-flow-strategy.ts

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

@ -1,6 +1,6 @@
import { noop } from '@abp/ng.core'; import { noop } from '@abp/ng.core';
import { Params } from '@angular/router'; import { Params } from '@angular/router';
import { from, of } from 'rxjs'; import { filter, from, of, tap } from 'rxjs';
import { AuthFlowStrategy } from './auth-flow-strategy'; import { AuthFlowStrategy } from './auth-flow-strategy';
import { isTokenExpired } from '../utils'; import { isTokenExpired } from '../utils';
@ -12,6 +12,18 @@ export class AuthCodeFlowStrategy extends AuthFlowStrategy {
return super return super
.init() .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.oAuthService.tryLogin().catch(noop)) .then(() => this.oAuthService.tryLogin().catch(noop))
.then(() => this.oAuthService.setupAutomaticSilentRefresh()); .then(() => this.oAuthService.setupAutomaticSilentRefresh());
} }

Loading…
Cancel
Save