From a7302a90bc547da750c6217039dcdd4c7f97aabc Mon Sep 17 00:00:00 2001
From: Hagen <hagen.dressler@mni.thm.de>
Date: Wed, 7 Mar 2018 22:54:35 +0100
Subject: [PATCH] Edit service comment (add function addComment)

---
 src/app/comment.service.ts | 15 ++++++++++++++-
 1 file changed, 14 insertions(+), 1 deletion(-)

diff --git a/src/app/comment.service.ts b/src/app/comment.service.ts
index 82a5f77f6..635c2edda 100644
--- a/src/app/comment.service.ts
+++ b/src/app/comment.service.ts
@@ -1,8 +1,21 @@
 import { Injectable } from '@angular/core';
+import { HttpClient, HttpHeaders } from '@angular/common/http';
+
+import { Observable } from 'rxjs/Observable';
+
+
+const httpOptions = {
+  headers: new HttpHeaders({ 'Content-Type': 'application/json' })
+};
 
 @Injectable()
 export class CommentService {
+  private commentsUrl = 'api/comments';
 
-  constructor() { }
+  constructor( private http: HttpClient ) {
+  }
 
+  addComment(comment: Comment): Observable<Comment> {
+    return this.http.post<Comment>(this.commentsUrl, comment, httpOptions);
+  }
 }
-- 
GitLab