File

src/app/guards/skip-login.guard.ts

Index

Methods

Constructor

constructor(router: Router, authService: AuthService)
Parameters :
Name Type Optional
router Router no
authService AuthService no

Methods

canActivate
canActivate()
Returns : boolean
import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { AuthService } from '../services/auth.service';

@Injectable()
export class SkipLoginGuard implements CanActivate {
  constructor(private router: Router, private authService: AuthService) {}

  canActivate() {
    if (this.authService.authenticated) {
      this.router.navigate(['/start']);
      return false;
    }
    return true;
  }
}

results matching ""

    No results matching ""