Clean up
This commit is contained in:
parent
dbab1bdf08
commit
8a6c4e1603
@ -1,6 +0,0 @@
|
|||||||
export class Hello {
|
|
||||||
constructor(public id?: number,
|
|
||||||
public message?: string,
|
|
||||||
) {
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,7 +1,5 @@
|
|||||||
<h1>LF12 Starter</h1>
|
<h1>LF12 Starter</h1>
|
||||||
|
|
||||||
<a href="/hello">hello</a>
|
|
||||||
|
|
||||||
<router-outlet></router-outlet>
|
<router-outlet></router-outlet>
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,7 +1,4 @@
|
|||||||
import { Routes } from '@angular/router';
|
import {Routes} from '@angular/router';
|
||||||
import {HelloListComponent} from "./hello-list/hello-list.component";
|
|
||||||
import {authGuard} from "./auth.guard";
|
|
||||||
|
|
||||||
export const routes: Routes = [
|
export const routes: Routes = [
|
||||||
{ path: 'hello', component: HelloListComponent , canActivate: [authGuard] }
|
|
||||||
];
|
];
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
<h3>List of Hellos</h3>
|
|
||||||
<ul>
|
|
||||||
@for(e of employees$ | async; track e.id) {
|
|
||||||
<li>
|
|
||||||
{{e.id }}, {{e.message}}
|
|
||||||
</li>
|
|
||||||
}
|
|
||||||
</ul>
|
|
@ -1,31 +0,0 @@
|
|||||||
import { Component } from '@angular/core';
|
|
||||||
import {Observable, of} from "rxjs";
|
|
||||||
import {Hello} from "../Hello";
|
|
||||||
import {HttpClient, HttpClientModule, HttpHeaders, provideHttpClient} from "@angular/common/http";
|
|
||||||
import {AsyncPipe} from "@angular/common";
|
|
||||||
import {KeycloakService} from "keycloak-angular";
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
selector: 'app-hello-list',
|
|
||||||
standalone: true,
|
|
||||||
imports: [
|
|
||||||
AsyncPipe
|
|
||||||
],
|
|
||||||
providers: [KeycloakService],
|
|
||||||
templateUrl: './hello-list.component.html',
|
|
||||||
styleUrl: './hello-list.component.css'
|
|
||||||
})
|
|
||||||
export class HelloListComponent {
|
|
||||||
employees$: Observable<Hello[]>;
|
|
||||||
|
|
||||||
constructor(private http: HttpClient) {
|
|
||||||
this.employees$ = of([]);
|
|
||||||
this.fetchData();
|
|
||||||
}
|
|
||||||
|
|
||||||
fetchData() {
|
|
||||||
this.employees$ = this.http.get<Hello[]>('/backend/hellos');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
Loading…
x
Reference in New Issue
Block a user