import {NgModule} from '@angular/core'; import {RouterModule, Routes} from '@angular/router'; import {LoginComponent} from "./login/login.component"; import {SignupComponent} from "./signup/signup.component"; import {AdminDashboardComponent} from "./admin-dashboard/admin-dashboard.component"; import {AuthGuard} from "./shared/auth/auth.guard"; import {RoleGuard} from "./shared/auth/role.guard"; import {StationComponent} from "./station/station.component"; import {SensorComponent} from "./station/sensor/sensor.component"; import {ClientComponent} from "./station/client/client.component"; import {HostComponent} from "./station/host/host.component"; import {DashboardComponent} from "./dashboard/dashboard.component"; const routes: Routes = [ {path: '', redirectTo: 'dashboard', pathMatch: 'full'}, {path: 'dashboard', component: DashboardComponent}, {path: 'login', component: LoginComponent}, {path: 'signup', component: SignupComponent}, {path: 'admin', component: AdminDashboardComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, {path: 'station', component: StationComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, {path: 'station/sensor', component: SensorComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, {path: 'station/client', component: ClientComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, {path: 'station/host', component: HostComponent, canActivate: [RoleGuard], data: {roles: ['ROLE_ADMIN']}}, ]; @NgModule({ imports: [RouterModule.forRoot(routes)], exports: [RouterModule] }) export class AppRoutingModule { }