shell.routes.ts 1.32 KB
Newer Older
Trần Anh Phú's avatar
Trần Anh Phú committed
1 2 3 4
import { Routes } from '@angular/router';
import { LayoutComponent } from '../ui/layout.component';
import { AuthGuard } from '../../+login/data-access/guard/auth.guard';
import { AdminGuard } from '../../+login/data-access/guard/admin.guard';
vtduong0912's avatar
vtduong0912 committed
5 6
import { JobComponent } from '../../+job/feature/job.component';
import { LoginGuard } from '../../+login/data-access/guard/login.guard';
Trần Anh Phú's avatar
Trần Anh Phú committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36

export const shellRoutes: Routes = [
  {
    path: '',
    component: LayoutComponent,
    children: [
      {
        path: '',
        pathMatch: 'full',
        redirectTo: 'home',
      },
      {
        path: 'home',
        canActivate: [], //not have guard yet, set up later
        loadChildren: () => import('../../+home/home.routes'),
      },
    ],
  },
  {
    path: 'admin',
    children: [
      {
        path: '',
        canActivate: [AdminGuard],
        loadChildren: () => import('../../+admin/admin.routes'),
      },
    ],
  },
  {
    path: 'login',
vtduong0912's avatar
vtduong0912 committed
37 38 39 40
    component: LayoutComponent,
    children: [
      {
        path: '',
vtduong0912's avatar
vtduong0912 committed
41
        canActivate: [LoginGuard],
vtduong0912's avatar
vtduong0912 committed
42 43 44
        loadChildren: () => import('../../+login/login.routes'),
      }
    ]
Trần Anh Phú's avatar
Trần Anh Phú committed
45
  },
vtduong0912's avatar
vtduong0912 committed
46 47 48 49 50 51 52 53 54 55 56
  {
    path: 'jobs',
    component: LayoutComponent,
    children: [
      {
        path: '',
        canActivate: [],
        loadChildren: () => import('../../+job/job.routes')
      }
    ]
  }
Trần Anh Phú's avatar
Trần Anh Phú committed
57
];