authe service login flow change
This commit is contained in:
parent
01c90ad4d6
commit
37ae16341f
|
@ -12,7 +12,7 @@ import { Guid } from '@common/types/guid';
|
||||||
import { TranslateService } from '@ngx-translate/core';
|
import { TranslateService } from '@ngx-translate/core';
|
||||||
import { KeycloakEventType, KeycloakService } from 'keycloak-angular';
|
import { KeycloakEventType, KeycloakService } from 'keycloak-angular';
|
||||||
import { Observable, Subject, forkJoin, from, of } from 'rxjs';
|
import { Observable, Subject, forkJoin, from, of } from 'rxjs';
|
||||||
import { exhaustMap, map, takeUntil } from 'rxjs/operators';
|
import { concatMap, exhaustMap, map, takeUntil } from 'rxjs/operators';
|
||||||
import { ConfigurationService } from '../configuration/configuration.service';
|
import { ConfigurationService } from '../configuration/configuration.service';
|
||||||
import { PrincipalService } from '../http/principal.service';
|
import { PrincipalService } from '../http/principal.service';
|
||||||
import { TenantHandlingService } from '../tenant/tenant-handling.service';
|
import { TenantHandlingService } from '../tenant/tenant-handling.service';
|
||||||
|
@ -170,13 +170,17 @@ export class AuthService extends BaseService {
|
||||||
public prepareAuthRequest(observable: Observable<string>, tenantCode: string, httpParams?: Object): Observable<boolean> {
|
public prepareAuthRequest(observable: Observable<string>, tenantCode: string, httpParams?: Object): Observable<boolean> {
|
||||||
return observable.pipe(
|
return observable.pipe(
|
||||||
map((x) => this.currentAuthenticationToken(x)),
|
map((x) => this.currentAuthenticationToken(x)),
|
||||||
exhaustMap(() => forkJoin([
|
concatMap(response => {
|
||||||
this.accessToken ? this.ensureTenant(tenantCode ?? this.selectedTenant() ?? 'default') : of(false),
|
return this.accessToken ? this.ensureTenant(tenantCode ?? this.selectedTenant() ?? 'default') : of(false);
|
||||||
this.accessToken ? this.principalService.me(httpParams) : of(null),
|
}),
|
||||||
this.accessToken ? this.tenantHandlingService.loadTenantCssColors() : of(null),
|
concatMap(response => {
|
||||||
])),
|
return this.accessToken ? this.principalService.me(httpParams) : of(null);
|
||||||
|
}),
|
||||||
|
concatMap(response => {
|
||||||
|
this.currentAccount(response);
|
||||||
|
return this.accessToken ? this.tenantHandlingService.loadTenantCssColors() : of(null);
|
||||||
|
}),
|
||||||
map((item) => {
|
map((item) => {
|
||||||
this.currentAccount(item[1]);
|
|
||||||
this.tenantHandlingService.applyTenantCssColors(item[2]?.cssColors);
|
this.tenantHandlingService.applyTenantCssColors(item[2]?.cssColors);
|
||||||
return true;
|
return true;
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in New Issue