All files / src/app/pages/login login-page.component.ts

94.11% Statements 16/17
68.75% Branches 11/16
100% Functions 4/4
93.33% Lines 14/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 381x 1x 1x 1x   1x 1x                 1x         2x     2x 2x       2x     2x 2x 2x        
import { ChangeDetectionStrategy, Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { Observable, of } from 'rxjs';
import { map } from 'rxjs/operators';
 
import { AccountFacade } from 'ish-core/facades/account.facade';
import { AppFacade } from 'ish-core/facades/app.facade';
 
/**
 * The Login Page Container displays the login page component {@link LoginPageComponent} as wrapper for the login form
 */
@Component({
  templateUrl: './login-page.component.html',
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class LoginPageComponent implements OnInit {
  isLoggedIn$: Observable<boolean>;
  loginMessageKey$: Observable<string>;
  routingInProgress$: Observable<boolean>;
 
  constructor(private accountFacade: AccountFacade, private route: ActivatedRoute, private appFacade: AppFacade) {}
 
  ngOnInit() {
    this.isLoggedIn$ = this.accountFacade.isLoggedIn$;
    Iif (SSR) {
      // SSR response should always display loading animation
      this.routingInProgress$ = of(true);
    } else {
      this.routingInProgress$ = this.appFacade.routingInProgress$;
    }
 
    this.loginMessageKey$ = this.route.queryParamMap.pipe(
      map(params => params.get('messageKey')),
      map(messageKey => (messageKey ? `account.login.${messageKey}.message` : undefined))
    );
  }
}