diff --git a/src/app/comment.service.ts b/src/app/comment.service.ts index 635c2eddaf63750b32145023c4ab56fe3dd1e2a1..44b1b7c9f8c1aa10c09647c1fc5f5201042cf1d9 100644 --- a/src/app/comment.service.ts +++ b/src/app/comment.service.ts @@ -3,6 +3,8 @@ import { HttpClient, HttpHeaders } from '@angular/common/http'; import { Observable } from 'rxjs/Observable'; +import { Comment } from './comment'; + const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' }) diff --git a/src/app/create-comment/create-comment.component.ts b/src/app/create-comment/create-comment.component.ts index 337ec0218ee419ece3472b41cba119cea76080d8..14b97eb5c77a0ac7c8245b0126c7a7fea2050f29 100644 --- a/src/app/create-comment/create-comment.component.ts +++ b/src/app/create-comment/create-comment.component.ts @@ -3,6 +3,7 @@ import { ActivatedRoute } from '@angular/router'; import { Location } from '@angular/common'; import { Room } from '../room'; +import { Comment } from '../comment'; import { RoomService } from '../room.service'; import { CommentService} from '../comment.service'; @@ -34,9 +35,15 @@ export class CreateCommentComponent implements OnInit { send(subject: string, body: string): void { subject = subject.trim(); body = body.trim(); - if (!subject || !body) { return; } - this.commentService.addComment( { roomId: this.room.id, subject: subject, - body: body, creationTimestamp: Date.now() } as Comment ).subscribe(); + if (!subject || !body) { + return; + } + this.commentService.addComment({ + roomId: this.room.id, + subject: subject, + body: body, + creationTimestamp: Date.now() + } as Comment).subscribe(); } goBack(): void {