bstlboard-front/src/app/app-routing.module.ts

50 lines
2.7 KiB
TypeScript
Raw Normal View History

2021-10-03 17:40:30 +02:00
import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { AuthGuard, AuthUpdateGuard, AuthenticatedGuard, AnonymousGuard } from './auth/auth.guard';
2021-10-04 13:02:30 +02:00
import { PageBookmarks } from './pages/bookmarks/bookmarks.page';
2021-10-04 16:57:29 +02:00
import { PageComment } from './pages/comment/comment.page';
2021-10-03 17:40:30 +02:00
import { PageEntry } from './pages/entry/entry.page';
2021-10-05 14:39:31 +02:00
import { PageHot } from './pages/hot/hot.page';
import { PageLast } from './pages/last/last.page';
2021-10-03 17:40:30 +02:00
import { PageLogin } from './pages/login/login.page';
import { PageNew } from './pages/new/new.page';
2021-10-04 16:57:29 +02:00
import { PageNotFound } from './pages/notfound/notfound.page';
2021-10-03 17:40:30 +02:00
import { PageSettings } from './pages/settings/settings.page';
import { PageSubmission } from './pages/submission/submission.page';
import { PageTop } from './pages/top/top.page';
2021-10-05 08:41:38 +02:00
import { PageUnavailable } from './pages/unavailable/unavailable.page';
2021-10-04 16:57:29 +02:00
import { PageUser } from './pages/user/user.page';
import { PageUserComments } from './pages/user/usercomments/usercomments.page';
import { PageUserEntries } from './pages/user/userentries/userentries.page';
2021-10-03 17:40:30 +02:00
import { UiMain } from './ui/main/main.ui';
const routes: Routes = [
{
path: '', component: UiMain, children: [
{ path: '', component: PageTop, canActivate: [ AuthenticatedGuard ] },
2021-10-04 16:57:29 +02:00
{ path: 'c/:id', component: PageComment, canActivate: [ AuthenticatedGuard ] },
2021-10-03 17:40:30 +02:00
{ path: 'e/:id', component: PageEntry, canActivate: [ AuthenticatedGuard ] },
2021-10-04 16:57:29 +02:00
{ path: 'u/:username', component: PageUser, canActivate: [ AuthenticatedGuard ] },
{ path: 'u/c/:username', component: PageUserComments, canActivate: [ AuthenticatedGuard ] },
{ path: 'u/e/:username', component: PageUserEntries, canActivate: [ AuthenticatedGuard ] },
2021-10-05 14:39:31 +02:00
{ path: 'hot', component: PageHot, canActivate: [ AuthenticatedGuard ] },
{ path: 'last', component: PageLast, canActivate: [ AuthenticatedGuard ] },
2021-10-03 17:40:30 +02:00
{ path: 'new', component: PageNew, canActivate: [ AuthenticatedGuard ] },
2021-10-04 13:02:30 +02:00
{ path: 'bookmarks', component: PageBookmarks, canActivate: [ AuthenticatedGuard ] },
2021-10-03 17:40:30 +02:00
{ path: 'submit', component: PageSubmission, canActivate: [ AuthenticatedGuard ] },
{ path: 'login', component: PageLogin, canActivate: [ AnonymousGuard ] },
2021-10-05 14:39:31 +02:00
{ path: 'settings', component: PageSettings, canActivate: [ AuthenticatedGuard ] },
2021-10-05 08:41:38 +02:00
{ path: 'unavailable', component: PageUnavailable },
{ path: '**', component: PageNotFound, pathMatch: 'full', canActivate: [ AuthUpdateGuard ] },
2021-10-03 17:40:30 +02:00
]
},
];
@NgModule({
imports: [ RouterModule.forRoot(routes, { onSameUrlNavigation: 'reload', relativeLinkResolution: 'legacy' }) ],
exports: [ RouterModule ]
})
export class AppRoutingModule { }