@@ -6,11 +6,10 @@ import { catchError } from 'rxjs/operators';
66import { EMPTY } from 'rxjs' ;
77import { EditModeFlag } from './modules/edit-mode/domain/edit-mode' ;
88import { StorageService } from './modules/storage/services/storage.service' ;
9- import { ActivatedRoute , NavigationStart , Router } from '@angular/router' ;
9+ import { NavigationStart , Router } from '@angular/router' ;
1010import { ProjectService } from './modules/project/services/project.service' ;
1111import { ProjectData , ProjectStorage } from './domain/project' ;
1212import { AuthenticationService } from './modules/authentication/services/authentication.service' ;
13- import { HttpErrorResponse } from '@angular/common/http' ;
1413
1514@Component ( {
1615 selector : 'app-root' ,
@@ -29,7 +28,6 @@ export class AppComponent implements OnInit {
2928 constructor (
3029 public editMode : EditModeService ,
3130 public router : Router ,
32- private activatedRoute : ActivatedRoute ,
3331 private matIconRegistry : MatIconRegistry ,
3432 private domSanitizer : DomSanitizer ,
3533 private renderer : Renderer2 ,
@@ -42,22 +40,18 @@ export class AppComponent implements OnInit {
4240 }
4341
4442 ngOnInit ( ) {
45- this . activatedRoute . queryParams . subscribe ( params => {
46- if ( params [ 'sso' ] ) {
47- this . setSsoMode ( ) ;
48- }
49- } ) ;
43+ this . authenticationService . checkAndSetSsoMode ( ) ;
5044
5145 this . router . events . subscribe ( event => {
5246 if ( event instanceof NavigationStart ) {
5347 if ( event . url === '/' ) {
5448 this . loadAllProjects ( ) ;
49+ } else if ( event . url === '/login' || event . url === '/logout' ) {
50+ this . showLogoutButton = false ;
51+ this . isLoading = false ;
5552 }
56- this . isLoading = false ;
5753 }
5854 } ) ;
59-
60- this . checkShowLogoutButton ( ) ;
6155 }
6256
6357 getEditModeStatus ( ) {
@@ -74,23 +68,6 @@ export class AppComponent implements OnInit {
7468 } ) ;
7569 }
7670
77- private checkShowLogoutButton ( ) {
78- return this . router . events . subscribe ( event => {
79- if ( event instanceof NavigationStart && ( event . url === '/login' || event . url === '/logout' ) ) {
80- this . showLogoutButton = false ;
81- }
82- } ) ;
83- }
84-
85- private setSsoMode ( ) {
86- this . authenticationService . sso = true ;
87- this . router . navigate ( [ ] , {
88- queryParams : {
89- sso : null
90- }
91- } ) ;
92- }
93-
9471 private checkRedirectToProjectDetail ( ) {
9572 const projectKey = this . getProjectKeyFormStorage ( ) ;
9673 if ( projectKey ) {
@@ -109,7 +86,7 @@ export class AppComponent implements OnInit {
10986 this . projectService
11087 . getAllProjects ( )
11188 . pipe (
112- catchError ( ( response : HttpErrorResponse ) => {
89+ catchError ( ( ) => {
11390 // show generic error page
11491 this . isLoading = false ;
11592 this . isError = true ;
0 commit comments