mycontrolpanel/src/app/app-routing.module.ts

57 lines
2.0 KiB
TypeScript

import { NgModule } from '@angular/core';
import { Routes, RouterModule } from '@angular/router';
import { HomeComponent } from './control-panel/home/home.component';
import { AutomationComponent } from './control-panel/automation/automation.component';
import { AuthGuard } from './_helpers/auth.guard';
import { NotFoundComponent } from './control-panel/not-found/not-found.component';
import { ProfileComponent } from './control-panel/profile/profile/profile.component';
import { EditProfileComponent } from './control-panel/profile/edit-profile/edit-profile.component';
import { EditAutomationComponent } from './control-panel/automation/edit-automation/edit-automation.component';
import { DevicesComponent } from './control-panel/devices/devices.component';
import { BetComponent } from './control-panel/bet/bet.component';
const routes: Routes =
[
{ path : '', redirectTo: 'home', pathMatch: 'full'},
{ path : 'home', component: HomeComponent },
{
path: 'profile',
canActivate: [ AuthGuard ],
children: [
{ path: '', component: ProfileComponent},
{ path: ':profileId', children: [
{ path: '', component: ProfileComponent},
{ path: 'dashboard',
loadChildren: () =>
import('../app/control-panel/dashboard/dashboard.module').then(m => m.DashboardModule),
canActivate: [ AuthGuard ]
},
{ path: 'edit', component: EditProfileComponent},
{ path: 'automation', children: [
{ path: '', component: AutomationComponent},
{ path: ':configurationId', component: EditAutomationComponent}
]},
{ path: 'devices', children: [
{ path: '', component: DevicesComponent}
]},
{ path: 'bet', children: [
{ path: '', component: BetComponent}
]}
]}
]
},
{ path: '**', component: NotFoundComponent}
];
@NgModule({
imports:
[
RouterModule.forRoot(routes)
],
exports:
[
RouterModule
]
})
export class AppRoutingModule { }