Projekt

Obecné

Profil

Stáhnout (1.28 KB) Statistiky
| Větev: | Tag: | Revize:
1
import {NgModule} from '@angular/core';
2
import {RouterModule, Routes} from '@angular/router';
3
import {LoginComponent} from './login/components/login.component';
4
import {DashboardComponent} from './dashboard/components/dashboard.component';
5
import {AuthGuard} from './auth/guards/auth.guard';
6
import {RoleGuard} from './auth/guards/role.guard';
7
import {AdministrationComponent} from './administration/components/administration.component';
8
import {SensorComponent} from './sensor/components/sensor.component';
9

    
10
const routes: Routes = [
11
  {
12
    path: '',
13
    redirectTo: 'login',
14
    pathMatch: 'full'
15
  }, {
16
    canActivate: [AuthGuard],
17
    path: 'dashboard',
18
    component: DashboardComponent,
19
    pathMatch: 'full'
20
  }, {
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
    canActivate: [AuthGuard, RoleGuard],
30
    path: 'administration',
31
    component: AdministrationComponent,
32
    pathMatch: 'full',
33
    data: {
34
      expectedRole: ['1']
35
    }
36
  },{
37
    path: 'login',
38
    component: LoginComponent,
39
    pathMatch: 'full',
40
  }
41
];
42

    
43
@NgModule({
44
  imports: [RouterModule.forRoot(routes)],
45
  exports: [RouterModule]
46
})
47
export class AppRoutingModule {
48
}
(1-1/4)