add initial Angular components, services, and routing setup

This commit is contained in:
Vincent Guillet
2025-09-24 11:31:28 +02:00
parent dfb4ac302a
commit 18f0364e26
64 changed files with 15879 additions and 0 deletions

View File

@@ -0,0 +1,13 @@
import { inject } from '@angular/core';
import { Router, UrlTree, CanActivateFn, CanMatchFn } from '@angular/router';
import { AuthService } from '../../services/auth/auth.service';
function redirectIfLoggedIn(): boolean | UrlTree {
const authService = inject(AuthService);
const router = inject(Router);
// Si déjà connecté -> redirige vers /home
return authService.isLoggedIn() ? router.parseUrl('/home') : true;
}
export const guestOnlyCanMatch: CanMatchFn = () => redirectIfLoggedIn();
export const guestOnlyCanActivate: CanActivateFn = () => redirectIfLoggedIn();