|
|
|
|
32
|
save(beer: any): Observable<any> {
|
32
|
save(beer: any): Observable<any> {
|
33
|
let result: Observable<Response>;
|
33
|
let result: Observable<Response>;
|
34
|
if (beer['href']) {
|
34
|
if (beer['href']) {
|
35
|
- // get id from href
|
|
|
36
|
- let id = beer.href.substring(beer.href.lastIndexOf('/'));
|
|
|
37
|
- result = this.http.put(this.BEER_API + id, beer);
|
|
|
|
|
35
|
+ result = this.http.put(beer.href, beer);
|
38
|
} else {
|
36
|
} else {
|
39
|
result = this.http.post(this.BEER_API, beer)
|
37
|
result = this.http.post(this.BEER_API, beer)
|
40
|
}
|
38
|
}
|