Projekt

Obecné

Profil

Stáhnout (1.28 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 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
  }, {
29 2c5da396 hlavja
    canActivate: [AuthGuard, RoleGuard],
30
    path: 'administration',
31
    component: AdministrationComponent,
32 675bbb8c hlavja
    pathMatch: 'full',
33
    data: {
34 2c5da396 hlavja
      expectedRole: ['1']
35 675bbb8c hlavja
    }
36
  },{
37
    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
}