1 import { NgModule } from '@angular/core'
2 import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3 import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
4 import { MenuGuards } from '@app/core/routing/menu-guard.service'
5 import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
6 import { MetaGuard, PreloadSelectedModulesList } from './core'
7 import { EmptyComponent } from './empty.component'
9 const routes: Routes = [
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule),
15 canActivateChild: [ MetaGuard ]
19 loadChildren: () => import('./+home/home.module').then(m => m.HomeModule)
23 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule),
24 canActivateChild: [ MetaGuard ]
28 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule),
29 canActivateChild: [ MetaGuard ]
32 path: 'verify-account',
33 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule),
34 canActivateChild: [ MetaGuard ]
38 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule),
39 canActivateChild: [ MetaGuard ]
42 path: 'video-channels',
43 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule),
44 canActivateChild: [ MetaGuard ]
48 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule),
49 canActivateChild: [ MetaGuard ]
53 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule),
54 canActivateChild: [ MetaGuard ]
57 path: 'reset-password',
58 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule),
59 canActivateChild: [ MetaGuard ]
63 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule),
64 canActivateChild: [ MetaGuard ]
68 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule),
69 canActivateChild: [ MetaGuard ]
73 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule),
74 canActivateChild: [ MetaGuard ]
77 path: 'remote-interaction',
78 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule),
79 canActivateChild: [ MetaGuard ]
82 path: 'video-playlists/watch',
83 redirectTo: 'videos/watch/playlist'
87 component: EmptyComponent // Avoid 404, app component will redirect dynamically
91 // Avoid 404 when changing language
92 for (const locale of POSSIBLE_LOCALES) {
95 component: EmptyComponent
101 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
106 RouterModule.forRoot(routes, {
107 useHash: Boolean(history.pushState) === false,
108 scrollPositionRestoration: 'disabled',
109 preloadingStrategy: PreloadSelectedModulesList,
110 anchorScrolling: 'disabled'
115 PreloadSelectedModulesList,
116 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
118 exports: [ RouterModule ]
120 export class AppRoutingModule {}