2021-10-03 17:40:30 +02:00
|
|
|
import { NgModule } from '@angular/core';
|
|
|
|
import { Routes, RouterModule } from '@angular/router';
|
|
|
|
|
2021-12-04 10:56:57 +01:00
|
|
|
import { 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-11-21 16:43:36 +01:00
|
|
|
import { PageEntryEdit } from './pages/entry/edit/edit.page';
|
2021-10-03 17:40:30 +02:00
|
|
|
import { PageEntry } from './pages/entry/entry.page';
|
|
|
|
import { PageLogin } from './pages/login/login.page';
|
2021-10-07 14:00:52 +02:00
|
|
|
import { PageModerationComments } from './pages/moderation/comments/moderation.comments.page';
|
|
|
|
import { PageModerationEntries } from './pages/moderation/entries/moderation.entries.page';
|
2021-10-04 16:57:29 +02:00
|
|
|
import { PageNotFound } from './pages/notfound/notfound.page';
|
2021-12-03 23:47:37 +01:00
|
|
|
import { PageSearch } from './pages/search/search.page';
|
2021-10-03 17:40:30 +02:00
|
|
|
import { PageSettings } from './pages/settings/settings.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';
|
2021-12-02 19:31:38 +01:00
|
|
|
|
2021-10-04 16:57:29 +02:00
|
|
|
import { PageUserComments } from './pages/user/usercomments/usercomments.page';
|
|
|
|
import { PageUserEntries } from './pages/user/userentries/userentries.page';
|
2021-12-04 00:16:46 +01:00
|
|
|
import { PageViewEdit } from './pages/view/edit/edit.page';
|
|
|
|
import { PageView } from './pages/view/view.page';
|
2021-10-03 17:40:30 +02:00
|
|
|
import { UiMain } from './ui/main/main.ui';
|
|
|
|
|
|
|
|
|
|
|
|
const routes: Routes = [
|
|
|
|
{
|
|
|
|
path: '', component: UiMain, children: [
|
2021-12-04 10:56:57 +01:00
|
|
|
{ path: '', component: PageView, canActivate: [ AuthenticatedGuard ] },
|
2021-10-06 12:14:47 +02:00
|
|
|
{ path: 'login', component: PageLogin, canActivate: [ AnonymousGuard ] },
|
2021-12-03 23:47:37 +01:00
|
|
|
{ path: 'search', component: PageSearch, canActivate: [ AuthenticatedGuard ] },
|
2021-10-07 14:00:52 +02:00
|
|
|
{ path: 'moderation/comments', component: PageModerationComments, canActivate: [ AuthenticatedGuard ] },
|
|
|
|
{ path: 'moderation/entries', component: PageModerationEntries, canActivate: [ AuthenticatedGuard ] },
|
2021-10-04 13:02:30 +02:00
|
|
|
{ path: 'bookmarks', component: PageBookmarks, canActivate: [ AuthenticatedGuard ] },
|
2021-10-05 14:39:31 +02:00
|
|
|
{ path: 'settings', component: PageSettings, canActivate: [ AuthenticatedGuard ] },
|
2021-12-02 19:31:38 +01:00
|
|
|
{ path: 'submit', component: PageEntryEdit, canActivate: [ AuthenticatedGuard ] },
|
2021-10-06 12:14:47 +02:00
|
|
|
{ path: 'e/:id', component: PageEntry, canActivate: [ AuthenticatedGuard ] },
|
2021-11-21 16:43:36 +01:00
|
|
|
{ path: 'e/:id/edit', component: PageEntryEdit, canActivate: [ AuthenticatedGuard ] },
|
2021-10-06 12:14:47 +02:00
|
|
|
{ path: 'c/:id', component: PageComment, canActivate: [ AuthenticatedGuard ] },
|
|
|
|
{ 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 08:41:38 +02:00
|
|
|
{ path: 'unavailable', component: PageUnavailable },
|
2021-12-04 00:21:24 +01:00
|
|
|
{ path: 'v', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
|
|
|
|
{ path: 'v/:name', component: PageView, canActivate: [ AuthenticatedGuard ] },
|
|
|
|
{ path: 'v/:name/edit', component: PageViewEdit, canActivate: [ AuthenticatedGuard ] },
|
|
|
|
{ path: 'v/:name/:username', component: PageView, canActivate: [ AuthenticatedGuard ] },
|
2021-10-05 08:41:38 +02:00
|
|
|
{ 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 { }
|