diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/app/components/comment-page/comment-page.component.ts | 20 | ||||
| -rw-r--r-- | src/app/components/comment/comment.component.ts | 12 |
2 files changed, 16 insertions, 16 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..9bbdc59 100644 --- a/src/app/components/comment-page/comment-page.component.ts +++ b/src/app/components/comment-page/comment-page.component.ts @@ -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 { diff --git a/src/app/components/comment/comment.component.ts b/src/app/components/comment/comment.component.ts index 5076769..d4dd9f4 100644 --- a/src/app/components/comment/comment.component.ts +++ b/src/app/components/comment/comment.component.ts @@ -25,23 +25,23 @@ export class CommentComponent implements OnInit { this.comment = this._commentService.getDefaultComment(); this.user = this._userService.getDefaultUser(); - this._commentService.getCommentRequest(Guid.parse(this.paramId)).subscribe( - (result: object) => { + this._commentService.getCommentRequest(Guid.parse(this.paramId)).subscribe({ + next: (result: object) => { Object.assign(this.comment, result); this.timeCreated = new Date(this.comment.timeCreated).toLocaleString('en-GB'); this.loadUser(); } - ); + }); } private loadUser(): void { - this._userService.getUserByUsernameRequest(this.comment.issuerUsername).subscribe( - (result: object) => { + this._userService.getUserByUsernameRequest(this.comment.issuerUsername).subscribe({ + next: (result: object) => { Object.assign(this.user, result); this.loaded = true; } - ); + }); } goToAuthorProfile(): void { |
