Projekt

Obecné

Profil

Stáhnout (1.43 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 5aeb60a5 mlacha
import {SettingComponent} from "./setting/component/setting.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
  }, {
30 2c5da396 hlavja
    canActivate: [AuthGuard, RoleGuard],
31
    path: 'administration',
32
    component: AdministrationComponent,
33 675bbb8c hlavja
    pathMatch: 'full',
34
    data: {
35 2c5da396 hlavja
      expectedRole: ['1']
36 675bbb8c hlavja
    }
37
  },{
38
    path: 'login',
39
    component: LoginComponent,
40 f8b9a3a2 hlavja
    pathMatch: 'full',
41 5aeb60a5 mlacha
  },{
42
    path: 'setting',
43
    component: SettingComponent,
44
    pathMatch: 'full',
45 f8b9a3a2 hlavja
  }
46
];
47 ee1670e3 hlavja
48
@NgModule({
49
  imports: [RouterModule.forRoot(routes)],
50
  exports: [RouterModule]
51
})
52 f8b9a3a2 hlavja
export class AppRoutingModule {
53
}