/** @file * @author Edouard DUPIN * @copyright 2022, Edouard DUPIN, all right reserved * @license PROPRIETARY (see license file) */ import { NgModule } from '@angular/core'; import { Routes, RouterModule } from '@angular/router'; // CLI imports router import { ChangePasswordScene, ForgotPasswordScene, HelpScene, HomeScene, SettingsScene, SignInScene, SignOutScene, SignUpScene, HomeUnregisteredScene, ManageAccountsScene, ApplicationsScene, ApplicationEditScene, } from '../base/scene'; import { OnlyAdminGuard, OnlyUnregisteredGuardHome, OnlyUsersGuard, OnlyUsersGuardHome } from 'common/service/session'; import { ForbiddenScene, NotFound404Scene } from 'common/scene'; const routes: Routes = [ { path: '', redirectTo: '/home', pathMatch: 'full' }, { path: 'forbidden', component: ForbiddenScene }, // ------------------------------------ // -- home global interface // ------------------------------------ { path: 'home', component: HomeScene, canActivate: [OnlyUsersGuardHome], // this route to unregistered path when not logged ==> permit to simplify display }, { path: 'unregistered', component: HomeUnregisteredScene, canActivate: [OnlyUnregisteredGuardHome], // jump to the home when registered }, { path: 'forgot-password', component: ForgotPasswordScene }, { path: 'help/:page', component: HelpScene }, { path: 'help', component: HelpScene }, { path: 'signin', component: SignInScene }, // SSO connection mode ==> redirect to the second part data package { path: 'signin/:applicationId/:dataReturn', component: SignInScene }, { path: 'signin/:applicationId', component: SignInScene }, { path: 'signup', component: SignUpScene }, { path: 'signup/:applicationId/:dataReturn', component: SignUpScene }, { path: 'signup/:applicationId', component: SignUpScene }, { path: 'signout/:applicationId/:dataReturn', component: SignOutScene }, { path: 'signout/:applicationId', component: SignOutScene }, { path: 'signout', component: SignOutScene }, { path: 'password', component: ChangePasswordScene, canActivate: [OnlyUsersGuard], }, { path: 'settings', component: SettingsScene, canActivate: [OnlyAdminGuard], }, { path: 'manage_accounts', component: ManageAccountsScene, canActivate: [OnlyAdminGuard], }, { path: 'applications', component: ApplicationsScene, canActivate: [OnlyAdminGuard], }, { path: 'application-edit/:applicationId', component: ApplicationEditScene, canActivate: [OnlyAdminGuard], }, { path: '**', component: NotFound404Scene, }, ]; @NgModule({ imports: [ RouterModule.forRoot(routes, { //enableTracing: true, // <-- debugging purposes only }), ], exports: [RouterModule], }) export class AppRoutingModule { }