Changeset View
Changeset View
Standalone View
Standalone View
src/app/app.routing.ts
import { Routes, RouterModule } from '@angular/router'; | import { Routes, RouterModule } from '@angular/router'; | ||||
import { AreaListComponent } from './_shared/areaList/areaList.component'; | |||||
import { Component404Component } from './404component/404.component'; | import { Component404Component } from './404component/404.component'; | ||||
import { DraftsComponent } from './drafts/drafts.component'; | |||||
import { CreatePostComponent } from './createPost/createPost.component'; | import { CreatePostComponent } from './createPost/createPost.component'; | ||||
import { HomeComponent } from './home/home.component'; | import { PostViewComponent } from './_shared/postView/postView.component'; | ||||
import { ImageUploadComponent } from './_shared/imageUpload/imageUpload.component'; | |||||
import { LoginComponent } from './login/login.component'; | import { LoginComponent } from './login/login.component'; | ||||
import { NotificationArchiveComponent } from './notificationArchive/notificationArchive.component'; | import { MyPostsComponent } from './_shared/myPosts/myPosts.component'; | ||||
import { NotificationComponent } from './notification/notification.component'; | import { NotificationsComponent } from './_shared/notifcations/notifications.component'; | ||||
import { RecoverComponent } from './recover/recover.component'; | import { PasswordComponent } from './_shared/password/password.component'; | ||||
import { RecoverPasswordComponent } from './recoverPassword/recoverPassword.component'; | import { ProfileComponent } from './_shared/profile/profile.component'; | ||||
import { RegisterComponent } from './register/register.component'; | |||||
import { RegisterSuccessComponent } from './registerSuccess/registerSuccess.component'; | |||||
import { PostViewComponent } from './postView/postView.component'; | |||||
import { ProfileComponent } from './profile/profile.component'; | |||||
import { ProfileViewComponent } from './profileView/profileView.component'; | |||||
import { UserPostsComponent } from './userPosts/userPosts.component'; | |||||
import { AuthGuard } from './_guards/auth.guard'; | import { AuthGuard } from './_guards/auth.guard'; | ||||
const appRoutes: Routes = [ | const appRoutes: Routes = [ | ||||
{ path: '', component: HomeComponent, canActivate: [AuthGuard] }, | { path: '', component: AreaListComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'areas/:area', component: PostViewComponent, canActivate: [AuthGuard] }, | |||||
{ path: 'areas/:area/:id', component: PostViewComponent }, | { path: 'areas/:area/:id', component: PostViewComponent }, | ||||
{ path: 'areas/:area/:id/:comments', component: PostViewComponent }, | { path: 'areas/:area/:id/:comments', component: PostViewComponent }, | ||||
{ path: 'create', component: CreatePostComponent, canActivate: [AuthGuard] }, | { path: 'create/:area', component: CreatePostComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'create/:id', component: CreatePostComponent, canActivate: [AuthGuard] }, | { path: 'create/:area/:id', component: CreatePostComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'drafts', component: DraftsComponent, canActivate: [AuthGuard] }, | |||||
{ path: 'login', component: LoginComponent }, | { path: 'login', component: LoginComponent }, | ||||
{ path: 'notifications', component: NotificationComponent, canActivate: [AuthGuard] }, | { path: 'notifications', component: NotificationsComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'notifications/:index', component: NotificationComponent, canActivate: [AuthGuard] }, | { path: 'notifications/:index', component: NotificationsComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'notifications/archive/:index', component: NotificationArchiveComponent, canActivate: [AuthGuard] }, | { path: 'notifications/archive/:index', component: NotificationsComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'posts', component: UserPostsComponent, canActivate: [AuthGuard] }, | { path: 'posts', component: AreaListComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'posts/:index', component: UserPostsComponent, canActivate: [AuthGuard] }, | { path: 'posts/:area', component: MyPostsComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'profile', component: ProfileComponent, canActivate: [AuthGuard] }, | { path: 'profile', component: ProfileComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'recover', component: RecoverComponent }, | { path: 'tools/image-upload', component: ImageUploadComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'recover/password/:trans', component: RecoverPasswordComponent }, | { path: 'tools/password', component: PasswordComponent, canActivate: [AuthGuard] }, | ||||
{ path: 'register', component: RegisterComponent }, | { path: 'user/:id', component: ProfileComponent }, | ||||
{ path: 'register/success', component: RegisterSuccessComponent }, | |||||
{ path: 'user/:id', component: ProfileViewComponent }, | |||||
// otherwise redirect to 404 | // otherwise redirect to 404 | ||||
{ path: '**', component: Component404Component } | { path: '**', component: Component404Component } | ||||
]; | ]; | ||||
export const Routing = RouterModule.forRoot(appRoutes); | export const Routing = RouterModule.forRoot(appRoutes); |