import { Component, OnInit } from '@angular/core';
import { ActivatedRoute } from '@angular/router';
import { SsoService } from 'sso';

@Component({
  selector: 'app-log-in',
  templateUrl: './log-in.component.html',
  styleUrls: ['./log-in.component.scss'],
})
export class LogInComponent implements OnInit {
  constructor(private route: ActivatedRoute, private ssoService: SsoService) {}

  ngOnInit() {
    const token = this.route.snapshot.paramMap.get('token');
    if (token === null) {
      // this.ssoService.logoff();
    }

    this.logIn(token);
  }

  private logIn(token: string) {
    this.ssoService.keyCardLogin(token);
  }
}
