]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blame - client/src/app/app-routing.module.ts
Reorganize left menu and account menu
[github/Chocobozzz/PeerTube.git] / client / src / app / app-routing.module.ts
CommitLineData
df98563e 1import { NgModule } from '@angular/core'
489290b8 2import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
489290b8 3import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
3b20bdd6 4import { MenuGuards } from '@app/core/routing/menu-guard.service'
67ed6552 5import { PreloadSelectedModulesList } from './core'
1942f11d 6import { EmptyComponent } from './empty.component'
ca00baa7 7import { POSSIBLE_LOCALES } from '@shared/core-utils/i18n'
693b1aba
C
8
9const routes: Routes = [
4b4f22fc
C
10 {
11 path: 'admin',
3b20bdd6
RK
12 canActivate: [ MenuGuards.close() ],
13 canDeactivate: [ MenuGuards.open() ],
f36da21e 14 loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
4b4f22fc
C
15 },
16 {
17 path: 'my-account',
f36da21e 18 loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
4b4f22fc 19 },
17119e4a
C
20 {
21 path: 'my-library',
22 loadChildren: () => import('./+my-library/my-library.module').then(m => m.MyLibraryModule)
23 },
d9eaee39
JM
24 {
25 path: 'verify-account',
f36da21e 26 loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
d9eaee39 27 },
4b4f22fc
C
28 {
29 path: 'accounts',
f36da21e 30 loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
4b4f22fc
C
31 },
32 {
33 path: 'video-channels',
f36da21e 34 loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
a51bad1a 35 },
78f912ed
C
36 {
37 path: 'about',
f36da21e 38 loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
78f912ed 39 },
b247a132
C
40 {
41 path: 'signup',
f36da21e 42 loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
b247a132 43 },
1942f11d
C
44 {
45 path: 'reset-password',
46 loadChildren: () => import('./+reset-password/reset-password.module').then(m => m.ResetPasswordModule)
47 },
48 {
49 path: 'login',
50 loadChildren: () => import('./+login/login.module').then(m => m.LoginModule)
51 },
52 {
53 path: 'search',
54 loadChildren: () => import('./+search/search.module').then(m => m.SearchModule)
55 },
56 {
57 path: 'videos',
58 loadChildren: () => import('./+videos/videos.module').then(m => m.VideosModule)
59 },
b889cdb2
C
60 {
61 path: '',
1942f11d 62 component: EmptyComponent // Avoid 404, app component will redirect dynamically
4b4f22fc 63 }
df98563e 64]
693b1aba 65
ca00baa7
C
66// Avoid 404 when changing language
67for (const locale of POSSIBLE_LOCALES) {
68 routes.push({
69 path: locale,
70 component: EmptyComponent
71 })
72}
73
74routes.push({
75 path: '**',
76 loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
77})
78
693b1aba 79@NgModule({
04de542a
C
80 imports: [
81 RouterModule.forRoot(routes, {
82 useHash: Boolean(history.pushState) === false,
489290b8 83 scrollPositionRestoration: 'disabled',
07a98236 84 preloadingStrategy: PreloadSelectedModulesList,
489290b8 85 anchorScrolling: 'disabled'
04de542a
C
86 })
87 ],
901637bb 88 providers: [
3b20bdd6 89 MenuGuards.guards,
489290b8
C
90 PreloadSelectedModulesList,
91 { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
901637bb 92 ],
693b1aba
C
93 exports: [ RouterModule ]
94})
95export class AppRoutingModule {}