Projekt

Obecné

Profil

Stáhnout (1.25 KB) Statistiky
| Větev: | Tag: | Revize:
1 f8b9a3a2 hlavja
import {NgModule} from '@angular/core';
2
import {RouterModule, Routes} from '@angular/router';
3 675bbb8c hlavja
import {LoginComponent} from './login/components/login.component';
4
import {DashboardComponent} from './dashboard/components/dashboard.component';
5 2c5da396 hlavja
import {AuthGuard} from './auth/guards/auth.guard';
6
import {RoleGuard} from './auth/guards/role.guard';
7 760650ec hlavja
import {SensorComponent} from './sensor/components/sensor.component';
8 370c3423 hlavja
import {UnitComponent} from './unit/components/unit.component';
9 ee1670e3 hlavja
10 f8b9a3a2 hlavja
const routes: Routes = [
11
  {
12
    path: '',
13 675bbb8c hlavja
    redirectTo: 'login',
14
    pathMatch: 'full'
15
  }, {
16 2c5da396 hlavja
    canActivate: [AuthGuard],
17 675bbb8c hlavja
    path: 'dashboard',
18
    component: DashboardComponent,
19 2c5da396 hlavja
    pathMatch: 'full'
20 760650ec hlavja
  }, {
21
    canActivate: [AuthGuard, RoleGuard],
22
    path: 'dashboard/unit/:unitId/sensor/:sensorId',
23
    component: SensorComponent,
24
    pathMatch: 'full',
25
    data: {
26
      expectedRole: ['1', '0']
27
    }
28 370c3423 hlavja
  }, {
29
    canActivate: [AuthGuard, RoleGuard],
30
    path: 'dashboard/unit/:unitId',
31
    component: UnitComponent,
32
    pathMatch: 'full',
33
    data: {
34
      expectedRole: ['1', '0']
35
    }
36 760650ec hlavja
  }, {
37 675bbb8c hlavja
    path: 'login',
38
    component: LoginComponent,
39 f8b9a3a2 hlavja
    pathMatch: 'full',
40
  }
41
];
42 ee1670e3 hlavja
43
@NgModule({
44
  imports: [RouterModule.forRoot(routes)],
45
  exports: [RouterModule]
46
})
47 f8b9a3a2 hlavja
export class AppRoutingModule {
48
}