Oleksandra Matviienko
3 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with
9 additions and
1 deletions
-
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); |
|
|
}); |
|
|
}); |
|
|
|