parent
3d522716c4
commit
1e5012b2cc
|
@ -97,7 +97,7 @@ export class HeroService {
|
||||||
/** POST: add a new hero to the server */
|
/** POST: add a new hero to the server */
|
||||||
addHero (hero: Hero): Observable<Hero> {
|
addHero (hero: Hero): Observable<Hero> {
|
||||||
return this.http.post<Hero>(this.heroesUrl, hero, httpOptions).pipe(
|
return this.http.post<Hero>(this.heroesUrl, hero, httpOptions).pipe(
|
||||||
tap((hero: Hero) => this.log(`added hero w/ id=${hero.id}`)),
|
tap((newHero: Hero) => this.log(`added hero w/ id=${newHero.id}`)),
|
||||||
catchError(this.handleError<Hero>('addHero'))
|
catchError(this.handleError<Hero>('addHero'))
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue