update routing to include AddProduct component and adjust guard activations
This commit is contained in:
@@ -4,9 +4,10 @@ import {RegisterComponent} from './pages/register/register.component';
|
|||||||
import {LoginComponent} from './pages/login/login.component';
|
import {LoginComponent} from './pages/login/login.component';
|
||||||
import {ProfileComponent} from './pages/profile/profile.component';
|
import {ProfileComponent} from './pages/profile/profile.component';
|
||||||
import {guestOnlyCanActivate, guestOnlyCanMatch} from './guards/guest-only/guest-only.guard';
|
import {guestOnlyCanActivate, guestOnlyCanMatch} from './guards/guest-only/guest-only.guard';
|
||||||
import {authOnlyCanMatch} from './guards/auth-only/auth-only.guard';
|
import {authOnlyCanActivate, authOnlyCanMatch} from './guards/auth-only/auth-only.guard';
|
||||||
import {AdminComponent} from './pages/admin/admin.component';
|
import {AdminComponent} from './pages/admin/admin.component';
|
||||||
import {adminOnlyCanMatch} from './guards/admin-only/admin-only.guard';
|
import {adminOnlyCanActivate, adminOnlyCanMatch} from './guards/admin-only/admin-only.guard';
|
||||||
|
import {AddProductComponent} from './pages/add-product/add-product.component';
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -45,7 +46,13 @@ export const routes: Routes = [
|
|||||||
path : 'admin',
|
path : 'admin',
|
||||||
component: AdminComponent,
|
component: AdminComponent,
|
||||||
canMatch: [adminOnlyCanMatch],
|
canMatch: [adminOnlyCanMatch],
|
||||||
canActivate: [adminOnlyCanMatch]
|
canActivate: [adminOnlyCanActivate]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
path : 'add-product',
|
||||||
|
component: AddProductComponent,
|
||||||
|
canMatch: [authOnlyCanMatch],
|
||||||
|
canActivate: [authOnlyCanActivate]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path : '**',
|
path : '**',
|
||||||
|
|||||||
Reference in New Issue
Block a user