Projekt

Obecné

Profil

Stáhnout (1.52 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
import {AdministrationComponent} from './administration/components/administration.component';
8 760650ec hlavja
import {SensorComponent} from './sensor/components/sensor.component';
9 370c3423 hlavja
import {UnitComponent} from './unit/components/unit.component';
10 ee1670e3 hlavja
11 f8b9a3a2 hlavja
const routes: Routes = [
12
  {
13
    path: '',
14 675bbb8c hlavja
    redirectTo: 'login',
15
    pathMatch: 'full'
16
  }, {
17 2c5da396 hlavja
    canActivate: [AuthGuard],
18 675bbb8c hlavja
    path: 'dashboard',
19
    component: DashboardComponent,
20 2c5da396 hlavja
    pathMatch: 'full'
21 760650ec hlavja
  }, {
22
    canActivate: [AuthGuard, RoleGuard],
23
    path: 'dashboard/unit/:unitId/sensor/:sensorId',
24
    component: SensorComponent,
25
    pathMatch: 'full',
26
    data: {
27
      expectedRole: ['1', '0']
28
    }
29 370c3423 hlavja
  }, {
30
    canActivate: [AuthGuard, RoleGuard],
31
    path: 'dashboard/unit/:unitId',
32
    component: UnitComponent,
33
    pathMatch: 'full',
34
    data: {
35
      expectedRole: ['1', '0']
36
    }
37 760650ec hlavja
  }, {
38 2c5da396 hlavja
    canActivate: [AuthGuard, RoleGuard],
39
    path: 'administration',
40
    component: AdministrationComponent,
41 675bbb8c hlavja
    pathMatch: 'full',
42
    data: {
43 a3ae1cab hlavja
      expectedRole: ['0']
44 675bbb8c hlavja
    }
45
  },{
46
    path: 'login',
47
    component: LoginComponent,
48 f8b9a3a2 hlavja
    pathMatch: 'full',
49
  }
50
];
51 ee1670e3 hlavja
52
@NgModule({
53
  imports: [RouterModule.forRoot(routes)],
54
  exports: [RouterModule]
55
})
56 f8b9a3a2 hlavja
export class AppRoutingModule {
57
}