
import { Injectable } from '@angular/core';
import { CanActivate, Router } from '@angular/router';
import { GameService } from './game.service';

@Injectable({
    providedIn: 'root'
})

export class AuthGuard implements CanActivate {
    constructor(private router: Router, private game: GameService) {}
    async canActivate(){
		if(this.game.cardset.length > 0){
			return true;
		}
		// no cards so redirect to the homepage
		this.router.navigate(['/home']);
		return false;
    }
}