var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
import { Injectable } from '@angular/core';
import { Router, CanActivate } from '@angular/router';
import { AuthService } from '../services/auth.service';
import * as i0 from "@angular/core";
import * as i1 from "../../public-api";
import * as i2 from "@angular/router";
var LoggedInGuard = /** @class */ (function () {
    function LoggedInGuard(auth, router) {
        this.auth = auth;
        this.router = router;
    }
    LoggedInGuard.prototype.canActivate = function () {
        if (!this.auth.isAuthenticated()) {
            this.router.navigate(['/login']);
        }
        return this.auth.isAuthenticated();
    };
    LoggedInGuard.ctorParameters = function () { return [
        { type: AuthService },
        { type: Router }
    ]; };
    LoggedInGuard.ɵprov = i0.ɵɵdefineInjectable({ factory: function LoggedInGuard_Factory() { return new i1.LoggedInGuard(i0.ɵɵinject(i1.AuthService), i0.ɵɵinject(i2.Router)); }, token: i1.LoggedInGuard, providedIn: "root" });
    LoggedInGuard = __decorate([
        Injectable({
            providedIn: 'root'
        })
    ], LoggedInGuard);
    return LoggedInGuard;
}());
export { LoggedInGuard };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibG9nZ2VkaW4tZ3VhcmQuc2VydmljZS5qcyIsInNvdXJjZVJvb3QiOiJuZzovL25nLWVhc3ljb21tZXJjZS8iLCJzb3VyY2VzIjpbImxpYi9ndWFyZHMvbG9nZ2VkaW4tZ3VhcmQuc2VydmljZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7QUFBQSxPQUFPLEVBQUUsVUFBVSxFQUFFLE1BQU0sZUFBZSxD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