Project

General

Profile

1
import {NgModule} from '@angular/core';
2
import {PreloadAllModules, RouterModule, Routes} from '@angular/router';
3
import {IsCommunity} from './openaireLibrary/connect/communityGuard/isCommunity.guard';
4
import {ConnectAdminLoginGuard} from './openaireLibrary/connect/communityGuard/connectAdminLoginGuard.guard';
5
import {AdminErrorPageComponent} from './pages/error/errorPage.component';
6
import {AdminLoginGuard} from "./openaireLibrary/login/adminLoginGuard.guard";
7
import {LoginGuard} from "./openaireLibrary/login/loginGuard.guard";
8

    
9
const routes: Routes = [
10
    {
11
        path: '',
12
        loadChildren: './pages/manage-communities/manage-communities.module#ManageCommunitiesModule',
13
        canActivateChild: [LoginGuard]
14
    },
15
    {
16
        path: 'reload',
17
        loadChildren: './reload/libReload.module#LibReloadModule',
18
        data: {hasSidebar: false, hasHeader: false}
19
    },
20
    {
21
        path: 'user-info',
22
        loadChildren: './login/libUser.module#LibUserModule',
23
        data: {hasSidebar: false}
24
    },
25
    {   path: 'error',
26
        pathMatch: 'full',
27
        component: AdminErrorPageComponent,
28
        data: {hasSidebar: false}
29
    },
30
    {
31
        path: 'connect/admin-tools',
32
        loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule',
33
        canActivateChild: [AdminLoginGuard],
34
        data: {portal: 'connect'}
35
    },
36
    {
37
        path: 'openaire/admin-tools',
38
        loadChildren: './pages/admin-tools/admin-tools-routing.module#AdminToolsRoutingModule',
39
        canActivateChild: [AdminLoginGuard],
40
        data: {portal: 'openaire'}
41
    },
42
    {
43
        path: 'admin-tools',
44
        loadChildren: './pages/admin-tools/portal-admin-tools-routing.module#PortalAdminToolsRoutingModule',
45
        canActivateChild: [AdminLoginGuard]
46
    },
47
    {
48
        path: ':community', redirectTo: '/:community/info/profile', pathMatch: 'full'
49
    },
50
    {
51
        path: ':community',
52
        loadChildren: './pages/community-routing.module#CommunityRoutingModule',
53
        canActivateChild: [IsCommunity, ConnectAdminLoginGuard]
54
    },
55
    {   path: '**',
56
        pathMatch: 'full',
57
        component: AdminErrorPageComponent
58
    }
59

    
60
];
61

    
62
@NgModule({
63
    imports: [RouterModule.forRoot(routes, {
64
        preloadingStrategy: PreloadAllModules,
65
        onSameUrlNavigation: "reload",
66
        relativeLinkResolution: 'corrected'
67
    })],
68
    exports: [ RouterModule ]
69
})
70
export class AppRoutingModule {}
(4-4/6)