diff options
| author | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-14 21:47:33 +0200 |
|---|---|---|
| committer | Danail Dimitrov <danaildimitrov321@gmail.com> | 2021-03-14 21:47:33 +0200 |
| commit | e4fc300d2fe82084c67c50258c76b60248850863 (patch) | |
| tree | 2b836291af4bc6801d7d809c828eb3e7d58a027a /src/app/components/comment-page/comment-page.component.ts | |
| parent | afe30ab78432d16c42b2f19e3bd8355e3f27a0e1 (diff) | |
| parent | 988c09b9233fd356b056b62593494772a2061993 (diff) | |
| download | DevHive-Angular-e4fc300d2fe82084c67c50258c76b60248850863.tar DevHive-Angular-e4fc300d2fe82084c67c50258c76b60248850863.tar.gz DevHive-Angular-e4fc300d2fe82084c67c50258c76b60248850863.zip | |
Merge branch 'dev' of https://github.com/Team-Kaleidoscope/DevHive-Angular into rating_system
Diffstat (limited to 'src/app/components/comment-page/comment-page.component.ts')
| -rw-r--r-- | src/app/components/comment-page/comment-page.component.ts | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src/app/components/comment-page/comment-page.component.ts b/src/app/components/comment-page/comment-page.component.ts index 413436e..5d256bf 100644 --- a/src/app/components/comment-page/comment-page.component.ts +++ b/src/app/components/comment-page/comment-page.component.ts @@ -5,7 +5,7 @@ import { Router } from '@angular/router'; import { Guid } from 'guid-typescript'; import { CommentService } from 'src/app/services/comment.service'; import { TokenService } from 'src/app/services/token.service'; -import { Comment } from 'src/models/comment'; +import { Comment } from 'src/models/comment.model'; @Component({ selector: 'app-comment-page', @@ -32,8 +32,8 @@ export class CommentPageComponent implements OnInit { // Gets the post and the logged in user and compares them, // to determine if the current post is made by the user - this._commentService.getCommentRequest(this.commentId).subscribe( - (result: object) => { + this._commentService.getCommentRequest(this.commentId).subscribe({ + next: (result: object) => { this.comment = result as Comment; if (this.loggedIn) { this.editable = this.comment.issuerUsername === this._tokenService.getUsernameFromSessionStorageToken(); @@ -41,10 +41,10 @@ export class CommentPageComponent implements OnInit { } this.loaded = true; }, - () => { + error: () => { this._router.navigate(['/not-found']); } - ); + }); this.editCommentFormGroup = this._fb.group({ newCommentMessage: new FormControl('') @@ -66,22 +66,22 @@ export class CommentPageComponent implements OnInit { if (newMessage !== '' && newMessage !== this.comment.message) { console.log(this.commentId); - this._commentService.putCommentWithSessionStorageRequest(this.commentId, this.comment.postId, newMessage).subscribe( - () => { + this._commentService.putCommentWithSessionStorageRequest(this.commentId, this.comment.postId, newMessage).subscribe({ + next: () => { this.reloadPage(); } - ); + }); } } this.editingComment = !this.editingComment; } deleteComment(): void { - this._commentService.deleteCommentWithSessionStorage(this.commentId).subscribe( - () => { + this._commentService.deleteCommentWithSessionStorage(this.commentId).subscribe({ + next: () => { this.toPost(); } - ); + }); } private reloadPage(): void { |
