header.component.ts 779 Bytes
Newer Older
Lukas Burgey's avatar
Lukas Burgey committed
1 2
import { Component, OnInit } from '@angular/core';

Lukas Burgey's avatar
Lukas Burgey committed
3 4 5
import { UserService } from '../user.service';
import { AllAuthInfo, IdP } from '../types/types.module';

Lukas Burgey's avatar
Lukas Burgey committed
6 7 8 9 10 11
@Component({
  selector: 'app-header',
  templateUrl: './header.component.html',
  styleUrls: ['./header.component.css']
})
export class HeaderComponent implements OnInit {
Lukas Burgey's avatar
Lukas Burgey committed
12 13
  public idps: IdP[];
  public selectedIdP: IdP;
Lukas Burgey's avatar
Lukas Burgey committed
14

Lukas Burgey's avatar
Lukas Burgey committed
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
  constructor(
    public userService: UserService,
  ) {
    if (!userService.loggedIn()) {
      this.userService.getIdPPreference().subscribe(
        (allAuthInfo: AllAuthInfo) => {
          if (allAuthInfo === null) {
            return;
          }
          this.idps = allAuthInfo.idps;
          this.selectedIdP = allAuthInfo.selected;
        }
      );
    }
  }
Lukas Burgey's avatar
Lukas Burgey committed
30 31 32 33

  ngOnInit() {
  }
}