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 { PreloadSelectedModulesList } from './core'
7 import { EmptyComponent } from './empty.component'
8 import { ActorsComponent } from './+actors/actors.component'
10 const routes: Routes = [
13 canActivate: [ MenuGuards.close() ],
14 canDeactivate: [ MenuGuards.open() ],
15 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
19 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
23 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
26 path: 'verify-account',
27 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
31 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
34 path: 'video-channels',
35 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
39 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
43 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
46 path: 'reset-password',
47 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
51 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
55 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
59 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
62 path: 'remote-interaction',
63 loadChildren: () => import('./+remote-interaction/remote-interaction.module').then(m => m.RemoteInteractionModule)
66 path: 'video-playlists/watch',
67 redirectTo: 'videos/watch/playlist'
71 redirectTo: 'accounts'
75 redirectTo: 'video-channels'
79 component: ActorsComponent
83 component: EmptyComponent // Avoid 404, app component will redirect dynamically
87 // Avoid 404 when changing language
88 for (const locale of POSSIBLE_LOCALES) {
91 component: EmptyComponent
97 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
102 RouterModule.forRoot(routes, {
103 useHash: Boolean(history.pushState) === false,
104 scrollPositionRestoration: 'disabled',
105 preloadingStrategy: PreloadSelectedModulesList,
106 anchorScrolling: 'disabled'
111 PreloadSelectedModulesList,
112 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
114 exports: [ RouterModule ]
116 export class AppRoutingModule {}