Add last login date to users
[oweals/peertube.git] / client / src / app / app-routing.module.ts
1 import { NgModule } from '@angular/core'
2 import { RouteReuseStrategy, RouterModule, Routes } from '@angular/router'
3
4 import { PreloadSelectedModulesList } from './core'
5 import { AppComponent } from '@app/app.component'
6 import { CustomReuseStrategy } from '@app/core/routing/custom-reuse-strategy'
7 import { MenuGuards } from '@app/core/routing/menu-guard.service'
8
9 const routes: Routes = [
10   {
11     path: 'admin',
12     canActivate: [ MenuGuards.close() ],
13     canDeactivate: [ MenuGuards.open() ],
14     loadChildren: () => import('./+admin/admin.module').then(m => m.AdminModule)
15   },
16   {
17     path: 'my-account',
18     loadChildren: () => import('./+my-account/my-account.module').then(m => m.MyAccountModule)
19   },
20   {
21     path: 'verify-account',
22     loadChildren: () => import('./+signup/+verify-account/verify-account.module').then(m => m.VerifyAccountModule)
23   },
24   {
25     path: 'accounts',
26     loadChildren: () => import('./+accounts/accounts.module').then(m => m.AccountsModule)
27   },
28   {
29     path: 'video-channels',
30     loadChildren: () => import('./+video-channels/video-channels.module').then(m => m.VideoChannelsModule)
31   },
32   {
33     path: 'about',
34     loadChildren: () => import('./+about/about.module').then(m => m.AboutModule)
35   },
36   {
37     path: 'signup',
38     loadChildren: () => import('./+signup/+register/register.module').then(m => m.RegisterModule)
39   },
40   {
41     path: '',
42     component: AppComponent // Avoid 404, app component will redirect dynamically
43   },
44   {
45     path: '**',
46     loadChildren: () => import('./+page-not-found/page-not-found.module').then(m => m.PageNotFoundModule)
47   }
48 ]
49
50 @NgModule({
51   imports: [
52     RouterModule.forRoot(routes, {
53       useHash: Boolean(history.pushState) === false,
54       scrollPositionRestoration: 'disabled',
55       preloadingStrategy: PreloadSelectedModulesList,
56       anchorScrolling: 'disabled'
57     })
58   ],
59   providers: [
60     MenuGuards.guards,
61     PreloadSelectedModulesList,
62     { provide: RouteReuseStrategy, useClass: CustomReuseStrategy }
63   ],
64   exports: [ RouterModule ]
65 })
66 export class AppRoutingModule {}