From 1f942b0da138d37c7330094ab35ef4e090981820 Mon Sep 17 00:00:00 2001 From: Alix JEUDI--LEMOINE Date: Thu, 29 May 2025 15:20:46 +0200 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20Added=20routes=20for=20administrati?= =?UTF-8?q?on=20(login/dashboard/config/users/notfound)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/app.routes.ts | 40 +++++++++++++++++++++++++++++++++++++++- 1 file changed, 39 insertions(+), 1 deletion(-) diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index dc39edb..98f1411 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,3 +1,41 @@ import { Routes } from '@angular/router'; +import { AdminGuard } from './auth/admin.guard'; +import { NotFoundComponent } from './components/not-found/not-found.component'; +import { LoginPageComponent } from './components/login-page/login-page.component'; +import { DashboardComponent } from './components/dashboard/dashboard.component'; +import { ConfigComponent } from './components/config/config.component'; +import { UsersComponent } from './components/users/users.component'; -export const routes: Routes = []; +export const routes: Routes = [ + { + path: '', + redirectTo: 'dashboard', + pathMatch: 'full' + }, + { + path: 'login', + component: LoginPageComponent + }, + { + path: '', + canActivate: [AdminGuard], + children: [ + { + path: 'dashboard', + component: DashboardComponent + }, + { + path: 'config', + component: ConfigComponent + }, + { + path: 'users', + component: UsersComponent + } + ] + }, + { + path: '**', + component: NotFoundComponent + } +];