import { NgModule } from '@angular/core'; import { ExtraOptions, RouterModule, Routes } from '@angular/router'; import { environment } from '@msfa-environment'; import { AuthGuard } from '@msfa-guards/auth.guard'; const routes: Routes = [ { path: '', data: { title: '' }, loadChildren: () => import('./pages/start/start.module').then(m => m.StartModule), canActivate: [AuthGuard], }, { path: 'administration', data: { title: 'Administration' }, loadChildren: () => import('./pages/administration/administration.module').then(m => m.AdministrationModule), canActivate: [AuthGuard], }, { path: 'deltagare', data: { title: 'Deltagare' }, loadChildren: () => import('./pages/deltagare/deltagare.module').then(m => m.DeltagareModule), canActivate: [AuthGuard], }, { path: 'nya-deltagare', data: { title: 'Nya deltagare' }, loadChildren: () => import('./pages/avrop/avrop.module').then(m => m.AvropModule), canActivate: [AuthGuard], }, { path: 'meddelanden', data: { title: 'Meddelanden' }, loadChildren: () => import('./pages/messages/messages.module').then(m => m.MessagesModule), canActivate: [AuthGuard], }, { path: 'statistik', data: { title: 'Statistik' }, loadChildren: () => import('./pages/statistics/statistics.module').then(m => m.StatisticsModule), canActivate: [AuthGuard], }, { path: 'installningar', data: { title: 'Inställningar' }, loadChildren: () => import('./pages/settings/settings.module').then(m => m.SettingsModule), canActivate: [AuthGuard], }, { path: 'releases', data: { title: 'Releases' }, loadChildren: () => import('./pages/releases/releases.module').then(m => m.ReleasesModule), canActivate: [AuthGuard], }, { path: 'logga-ut', data: { title: 'Logga ut' }, loadChildren: () => import('./pages/logout/logout.module').then(m => m.LogoutModule), canActivate: [AuthGuard], }, { path: 'organization-picker', loadChildren: () => import('./pages/organization-picker/organization-picker.module').then(m => m.OrganizationPickerModule), }, { path: 'mitt-konto', data: { title: 'Mitt konto' }, loadChildren: () => import('./pages/my-account/my-account.module').then(m => m.MyAccountModule), canActivate: [AuthGuard], }, ]; if (!environment.production) { routes.push({ path: 'mock-login', data: { title: 'Mock login' }, loadChildren: () => import('./pages/mock-login/mock-login.module').then(m => m.MockLoginModule), }); } routes.push({ path: '**', data: { title: 'Sidan hittas inte' }, loadChildren: () => import('./pages/page-not-found/page-not-found.module').then(m => m.PageNotFoundModule), canActivate: [AuthGuard], }); const options: ExtraOptions = { useHash: false, }; @NgModule({ imports: [RouterModule.forRoot(routes, options)], exports: [RouterModule], }) export class AppRoutingModule {}