import { ChangeDetectionStrategy , Component , OnInit } from '@angular/core' ; import { Router } from '@angular/router' ; import { generateLoginUrl } from '../shared' ; import { TokenService } from '../spotify-auth' ; @ Component ( { selector : 'sort-login' , templateUrl : './login.component.html' , styleUrls : [ './login.component.scss' ] , changeDetection : ChangeDetectionStrategy . OnPush , } ) export class LoginComponent implements OnInit { constructor ( private tokenSvc , private router ) { } githubUrl = 'https://github.com/christianmemije/sortify' ; get loginUrl ( ) : string { return generateLoginUrl ( '' ) ; } async ngOnInit ( ) { if ( ! ! this . tokenSvc . oAuthToken ) { await this . router . navigate ( [ '/' ] ) ; } } }