Browse Source

Merge 22930ade66 into be3207ab65

pull/15695/merge
Oleksandra Matviienko 3 days ago
committed by GitHub
parent
commit
5bf3eff117
No known key found for this signature in database GPG Key ID: B5690EEEBB952194
  1. 10
      ui-ngx/src/app/app.component.ts

10
ui-ngx/src/app/app.component.ts

@ -92,6 +92,14 @@ export class AppComponent {
} }
setupAuth() { setupAuth() {
// URL-token login (OAuth2 redirect to root) emits selectUserReady once;
// skip(1) would swallow it and gotoDefaultPlace would never fire.
const params = new URLSearchParams(window.location.search);
const hasRootUrlAuth = window.location.pathname === '/' && (
!!params.get('accessToken') ||
(!!params.get('username') && !!params.get('password'))
);
this.store.select(selectUserReady).pipe( this.store.select(selectUserReady).pipe(
filter((data) => data.isUserLoaded), filter((data) => data.isUserLoaded),
tap((data) => { tap((data) => {
@ -102,7 +110,7 @@ export class AppComponent {
} }
this.notifyUserLang(userLang); this.notifyUserLang(userLang);
}), }),
skip(1), skip(hasRootUrlAuth ? 0 : 1),
).subscribe((data) => { ).subscribe((data) => {
this.authService.gotoDefaultPlace(data.isAuthenticated); this.authService.gotoDefaultPlace(data.isAuthenticated);
}); });

Loading…
Cancel
Save