62 lines
1.6 KiB
TypeScript
62 lines
1.6 KiB
TypeScript
import {Routes} from '@angular/router';
|
|
import {HomeComponent} from './pages/home/home.component';
|
|
import {RegisterComponent} from './pages/auth/register/register.component';
|
|
import {LoginComponent} from './pages/auth/login/login.component';
|
|
import {ProfileComponent} from './pages/profile/profile.component';
|
|
import {guestOnlyCanActivate, guestOnlyCanMatch} from './guards/guest-only.guard';
|
|
import {adminOnlyCanActivate, adminOnlyCanMatch} from './guards/admin-only.guard';
|
|
import {authOnlyCanMatch} from './guards/auth-only.guard';
|
|
import {PsAdminComponent} from './pages/admin/ps-admin/ps-admin.component';
|
|
import {ProductsComponent} from './pages/products/products.component';
|
|
|
|
export const routes: Routes = [
|
|
{
|
|
path: '',
|
|
children: [
|
|
{
|
|
path: '',
|
|
component: HomeComponent
|
|
},
|
|
{
|
|
path: 'home',
|
|
component: HomeComponent
|
|
}
|
|
]
|
|
},
|
|
{
|
|
path: 'register',
|
|
component: RegisterComponent,
|
|
canMatch: [guestOnlyCanMatch],
|
|
canActivate: [guestOnlyCanActivate]
|
|
},
|
|
{
|
|
path: 'login',
|
|
component: LoginComponent,
|
|
canMatch: [guestOnlyCanMatch],
|
|
canActivate: [guestOnlyCanActivate]
|
|
|
|
},
|
|
{
|
|
path: 'profile',
|
|
component: ProfileComponent,
|
|
canMatch: [authOnlyCanMatch],
|
|
canActivate: [authOnlyCanMatch]
|
|
},
|
|
{
|
|
path: 'products',
|
|
component: ProductsComponent,
|
|
canMatch: [authOnlyCanMatch],
|
|
canActivate: [authOnlyCanMatch]
|
|
},
|
|
{
|
|
path: 'admin',
|
|
component: PsAdminComponent,
|
|
canMatch: [adminOnlyCanMatch],
|
|
canActivate: [adminOnlyCanActivate]
|
|
},
|
|
{
|
|
path: '**',
|
|
redirectTo: ''
|
|
}
|
|
];
|