diff --git a/kibicara-frontend/src/app/dashboard/dashboard-routing.module.ts b/kibicara-frontend/src/app/dashboard/dashboard-routing.module.ts index 77fca96..2e4ee40 100644 --- a/kibicara-frontend/src/app/dashboard/dashboard-routing.module.ts +++ b/kibicara-frontend/src/app/dashboard/dashboard-routing.module.ts @@ -3,15 +3,17 @@ import { Routes, RouterModule } from '@angular/router'; import { DashboardComponent } from './dashboard.component'; import { HoodsComponent } from './hoods/hoods.component'; import { SettingspageComponent } from './settingspage/settingspage.component'; +import { AuthGuard } from '../core/auth/auth.guard'; const routes: Routes = [ { path: '', component: DashboardComponent, children: [ - { path: 'list', component: HoodsComponent }, + { path: '', component: HoodsComponent }, { path: 'settings', component: SettingspageComponent }, ], + canActivate: [AuthGuard], }, ]; diff --git a/kibicara-frontend/src/app/dashboard/dashboard.component.html b/kibicara-frontend/src/app/dashboard/dashboard.component.html index 9c5fce9..0680b43 100644 --- a/kibicara-frontend/src/app/dashboard/dashboard.component.html +++ b/kibicara-frontend/src/app/dashboard/dashboard.component.html @@ -1 +1 @@ -
dashboard works!
+hoods works!
+hoodpage works!
+ +{{ hood.landingpage }} diff --git a/kibicara-frontend/src/app/hoodpage/hoodpage.component.ts b/kibicara-frontend/src/app/hoodpage/hoodpage.component.ts index bdd832f..b2d22cf 100644 --- a/kibicara-frontend/src/app/hoodpage/hoodpage.component.ts +++ b/kibicara-frontend/src/app/hoodpage/hoodpage.component.ts @@ -1,15 +1,36 @@ import { Component, OnInit } from '@angular/core'; +import { ActivatedRoute, Router } from '@angular/router'; +import { HoodsService, BodyHood } from '../core/api'; +import { first } from 'rxjs/operators'; @Component({ selector: 'app-hoodpage', templateUrl: './hoodpage.component.html', - styleUrls: ['./hoodpage.component.scss'] + styleUrls: ['./hoodpage.component.scss'], }) export class HoodpageComponent implements OnInit { + hood: BodyHood; - constructor() { } + constructor( + private route: ActivatedRoute, + private router: Router, + private readonly hoodService: HoodsService + ) {} ngOnInit(): void { + const hoodId = this.route.snapshot.params['id']; + if (hoodId) { + this.hoodService + .getHood(hoodId) + .pipe(first()) + .subscribe( + (data) => { + this.hood = data; + }, + (error) => { + this.router.navigate(['/404']); + } + ); + } } - }