import { Component, OnInit } from '@angular/core'; import { ActivatedRoute, Router } from '@angular/router'; import { AuthenticationService } from 'src/app/core/authentication.service'; import { api } from '../../../config'; const iamuri = api.IAM_URL; @Component({ selector: 'app-login', templateUrl: './login.component.html', styleUrls: ['./login.component.css'] }) export class LoginComponent implements OnInit { constructor( private activatedRoute: ActivatedRoute, private router: Router, private authenticationService: AuthenticationService, ) { } ngOnInit() { this.activatedRoute.paramMap.subscribe(paramMap => { if (paramMap.has('token')) { this.authenticationService.saveToken(paramMap.get('token')); if (this.authenticationService.isLoggedIn()) { this.router.navigateByUrl('/main/main'); } } else { window.location.href = `${iamuri}/session/login/fydfofnifhrndkspd`; } }); } }