diff options
author | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-02 23:13:27 -0500 |
---|---|---|
committer | Tucker Evans <tuckerevans24@gmail.com> | 2019-12-02 23:32:39 -0500 |
commit | 658dea27e47e3aab24598a74ee9940f82bea2368 (patch) | |
tree | e6f2938377890774ff3e80fae8f77797917a46e5 | |
parent | 04c3b3fd7ffd2e377f7e443b072a86a332e94ac1 (diff) |
Add deleteRecipe to backend service
-rw-r--r-- | recipeBuddy/src/app/REST_service/backend.service.ts | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/recipeBuddy/src/app/REST_service/backend.service.ts b/recipeBuddy/src/app/REST_service/backend.service.ts index 8ae05ca..1a2d933 100644 --- a/recipeBuddy/src/app/REST_service/backend.service.ts +++ b/recipeBuddy/src/app/REST_service/backend.service.ts @@ -47,9 +47,9 @@ export class BackendService { ) } + getRecipe(id): Observable<Recipe> { - console.log(this.apiURL + '/recipes' + id) return this.http.get<Msg>(this.apiURL + '/recipes/' + id) .pipe ( retry(1), @@ -70,6 +70,15 @@ export class BackendService { JSON.stringify(data), this.httpOptions) } + deleteRecipe(id): Observable<Msg> + { + return this.http.delete<Msg>(this.apiURL + '/recipes/' + id) + .pipe ( + retry(1), + catchError(this.handleError) + ) + } + handleError(error) { let errMsg = ''; if (error.error instanceof ErrorEvent) { |