Project

General

Profile

1
import {NgModule} from '@angular/core';
2
import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
3
import {OpenaireErrorPageComponent} from './error/errorPage.component';
4
import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard";
5
import {AdminDashboardGuard} from "./utils/adminDashboard.guard";
6
import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard";
7

    
8
const routes: Routes = [
9
  {
10
    path: 'reload',
11
    loadChildren: () => import('./reload/libReload.module').then(m => m.LibReloadModule),
12
    data: {hasSidebar: false, hasHeader: false}
13
  },
14
  {
15
    path: 'user-info',
16
    loadChildren: () => import('./login/libUser.module').then(m => m.LibUserModule),
17
    data: {hasSidebar: false, isFrontPage: true}
18
  },
19
  {
20
    path: 'error',
21
    component: OpenaireErrorPageComponent,
22
    data: {hasSidebar: false, isFrontPage: true}
23
  },
24
  {
25
    path: 'admin',
26
    loadChildren: () => import('./manageStakeholders/manageStakeholders.module').then(m => m.ManageStakeholdersModule),
27
    data: {hasAdminMenu: true},
28
    canActivateChild: [LoginGuard]
29
  },
30
  {
31
    path: 'admin/admin-tools',
32
    loadChildren: () => import('./admin-tools/portal-admin-tools-routing.module').then(m => m.PortalAdminToolsRoutingModule),
33
    canActivateChild: [AdminLoginGuard],
34
    data: {hasAdminMenu: true}
35
  },
36
  {
37
    path: 'admin/monitor/admin-tools',
38
    loadChildren: () => import('./admin-tools/admin-tools-routing.module').then(m => m.AdminToolsRoutingModule),
39
    canActivateChild: [AdminLoginGuard],
40
    data: {hasAdminMenu: true, portal: 'monitor'}
41
  },
42
  {
43
    path: 'admin/:stakeholder',
44
    loadChildren: () => import('./admin-stakeholder/admin-stakeholder-routing.module').then(m => m.AdminStakeholderRoutingModule),
45
    canActivateChild: [AdminDashboardGuard]
46
  },
47
  {path: 'theme', loadChildren: () => import('./openaireLibrary/utils/theme/theme.module').then(m => m.ThemeModule)},
48
  {
49
    path: '',
50
    loadChildren: () => import('./monitor/monitor.module').then(m => m.MonitorModule),
51
    data: {isFrontPage: true}
52
  },
53
  {
54
    path: '**',
55
    pathMatch: 'full',
56
    component: OpenaireErrorPageComponent,
57
    data: {hasSidebar: false, hasAdminMenu: false, isFrontPage: true}
58
  }
59
];
60

    
61
@NgModule({
62
  imports: [RouterModule.forRoot(routes, {
63
    preloadingStrategy: PreloadAllModules,
64
    onSameUrlNavigation: "reload"
65
  })],
66
  exports: [RouterModule]
67
})
68
export class AppRoutingModule {
69
}
(1-1/5)