last changes

This commit is contained in:
2021-01-15 16:40:20 +01:00
parent 24482da680
commit f88d3b5b39
2 changed files with 4 additions and 3 deletions

View File

@ -5,6 +5,7 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build-prod": "ng build --prod",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"

View File

@ -13,16 +13,16 @@ export class HeroService {
getHeroes(): Promise<Hero[]> {
this.messageService.add('HeroService: fetched heroes');
return this.http.get<Hero[]>(`http://172.16.3.185:5000/heroes`).toPromise()
return this.http.get<Hero[]>(`http://172.16.3.185:5000/heroes/heroes`).toPromise()
}
getHero(id: number): Promise<Hero> {
this.messageService.add(`HeroService: fetch hero id=${id}`);
return this.http.get<Hero>(`http://172.16.3.185:5000/hero/${id}`).toPromise()
return this.http.get<Hero>(`http://172.16.3.185:5000/heroes/hero/${id}`).toPromise()
}
updateHero(hero: Hero): Promise<any> {
this.messageService.add(`HeroService: save change: id=${hero.id}, name=${hero.name}`);
return this.http.put<Hero>(`http://172.16.3.185:5000/hero/${hero.id}`, hero).toPromise()
return this.http.put<Hero>(`http://172.16.3.185:5000/heroes/hero/${hero.id}`, hero).toPromise()
}
}