diff --git a/src/app/app.routes.ts b/src/app/app.routes.ts index dc39edb..98f1411 100644 --- a/src/app/app.routes.ts +++ b/src/app/app.routes.ts @@ -1,3 +1,41 @@ import { Routes } from '@angular/router'; +import { AdminGuard } from './auth/admin.guard'; +import { NotFoundComponent } from './components/not-found/not-found.component'; +import { LoginPageComponent } from './components/login-page/login-page.component'; +import { DashboardComponent } from './components/dashboard/dashboard.component'; +import { ConfigComponent } from './components/config/config.component'; +import { UsersComponent } from './components/users/users.component'; -export const routes: Routes = []; +export const routes: Routes = [ + { + path: '', + redirectTo: 'dashboard', + pathMatch: 'full' + }, + { + path: 'login', + component: LoginPageComponent + }, + { + path: '', + canActivate: [AdminGuard], + children: [ + { + path: 'dashboard', + component: DashboardComponent + }, + { + path: 'config', + component: ConfigComponent + }, + { + path: 'users', + component: UsersComponent + } + ] + }, + { + path: '**', + component: NotFoundComponent + } +];