mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-05-01 11:19:32 -05:00
21 lines
428 B
TypeScript
21 lines
428 B
TypeScript
import { Injectable } from '@angular/core';
|
|
import { Router } from '@angular/router';
|
|
import { AuthService } from './auth.service';
|
|
|
|
@Injectable({
|
|
providedIn: 'root'
|
|
})
|
|
export class AuthGuardService {
|
|
|
|
constructor(public auth: AuthService, public router: Router) { }
|
|
|
|
canActivate(): boolean {
|
|
if (!this.auth.isAuthenticated()) {
|
|
this.router.navigate(['login']);
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
}
|