All files / app/guards unauth.guard.ts

75% Statements 6/8
75% Branches 3/4
100% Functions 3/3
71.42% Lines 5/7

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21          142x     69x 69x         73x       73x    
import {Injectable} from "@angular/core";
import {CanActivate, Router} from "@angular/router"; 
import { SessionService } from "../services/session.service";
 
@Injectable({providedIn: 'root'})
export class UnauthGuard implements CanActivate {
 
  constructor( 
    private router: Router,
    private sessionService: SessionService,
  ) {
  }
 
  public canActivate(): boolean {
    Iif (this.sessionService.isLogged) {
      this.router.navigate(['rentals']);
      return false;
    }
    return true;
  }
}