Chore:
Moved to Angular 16 Moved to FastAPI 0.100.0 Moved to pydantic 2.0
This commit is contained in:
@ -1,13 +1,17 @@
|
||||
import { Injectable } from '@angular/core';
|
||||
import { Router, CanActivate, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
import { Router, ActivatedRouteSnapshot, RouterStateSnapshot } from '@angular/router';
|
||||
|
||||
import { ToasterService } from '../core/toaster.service';
|
||||
|
||||
import { AuthService } from './auth.service';
|
||||
|
||||
@Injectable({ providedIn: 'root' })
|
||||
export class AuthGuard implements CanActivate {
|
||||
constructor(private router: Router, private authService: AuthService, private toaster: ToasterService) {}
|
||||
export class AuthGuard {
|
||||
constructor(
|
||||
private router: Router,
|
||||
private authService: AuthService,
|
||||
private toaster: ToasterService,
|
||||
) {}
|
||||
|
||||
canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot) {
|
||||
const { user } = this.authService;
|
||||
|
||||
@ -19,7 +19,10 @@ export class AuthService {
|
||||
public device: Device;
|
||||
private currentUserSubject: BehaviorSubject<User | null> = new BehaviorSubject<User | null>(null);
|
||||
|
||||
constructor(private http: HttpClient, private cs: CookieService) {
|
||||
constructor(
|
||||
private http: HttpClient,
|
||||
private cs: CookieService,
|
||||
) {
|
||||
this.checkStorage();
|
||||
this.currentUser = this.currentUserSubject.asObservable();
|
||||
const deviceId = this.cs.getCookie('device_id');
|
||||
|
||||
Reference in New Issue
Block a user