From a126dab147ad4f7dd33ca1fb0e67e7406c9cda65 Mon Sep 17 00:00:00 2001 From: NyxiumYuuki Date: Tue, 1 Jun 2021 22:31:58 +0200 Subject: [PATCH] AuthGuard added (not working) --- frontend/src/app/app-routing.module.ts | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/frontend/src/app/app-routing.module.ts b/frontend/src/app/app-routing.module.ts index 91049af..adb20a0 100644 --- a/frontend/src/app/app-routing.module.ts +++ b/frontend/src/app/app-routing.module.ts @@ -2,20 +2,35 @@ import { NgModule } from '@angular/core'; import { RouterModule, Routes } from '@angular/router'; import {LoginComponent} from "./login/login.component"; import {ChatComponent} from "./chat/chat.component"; +import {AuthGuard} from "./auth.guard"; +import {ChangePasswordComponent} from "./change-password/change-password.component"; const routes: Routes = [ + // { + // path: 'login', + // component: LoginComponent, + // }, + // { + // path: '', + // canActivateChild: [AuthGuard], + // children: [ + // { path: 'chat', component: ChatComponent}, + // { path: 'changePassword', component: ChangePasswordComponent} + // ] + // } { path: '', component: LoginComponent, }, - { - path: 'chat', - component: ChatComponent, - } + { path: 'chat', + canActivateChild: [AuthGuard], + component: ChatComponent + }, + { path: 'changePassword', component: ChangePasswordComponent} ]; @NgModule({ imports: [RouterModule.forRoot(routes)], - exports: [RouterModule] + exports: [RouterModule], }) export class AppRoutingModule { }