From 59994f369746e6e37ababbceb6819bd654eac9ce Mon Sep 17 00:00:00 2001 From: trivernis Date: Thu, 16 Jan 2020 23:28:57 +0100 Subject: [PATCH] Fix votes not getting refreshed --- .../components/feed/postlist/postlist.component.ts | 12 ++++++------ src/app/services/feed/feed.service.ts | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/app/components/feed/postlist/postlist.component.ts b/src/app/components/feed/postlist/postlist.component.ts index ec2e5f1..b16794d 100644 --- a/src/app/components/feed/postlist/postlist.component.ts +++ b/src/app/components/feed/postlist/postlist.component.ts @@ -22,18 +22,18 @@ export class PostlistComponent implements OnInit { voteUp(pPost: Post) { this.feedService.upvote(pPost.id).subscribe(response => { // this.voteEvent.emit(true); - pPost.userVote = response.json().data.vote.post.userVote; - pPost.upvotes = response.json().data.vote.post.upvotes; - pPost.downvotes = response.json().data.vote.post.downvotes; + pPost.userVote = response.data.vote.post.userVote; + pPost.upvotes = response.data.vote.post.upvotes; + pPost.downvotes = response.data.vote.post.downvotes; }); } voteDown(pPost: Post) { this.feedService.downvote(pPost.id).subscribe(response => { // this.voteEvent.emit(true); - pPost.userVote = response.json().data.vote.post.userVote; - pPost.upvotes = response.json().data.vote.post.upvotes; - pPost.downvotes = response.json().data.vote.post.downvotes; + pPost.userVote = response.data.vote.post.userVote; + pPost.upvotes = response.data.vote.post.upvotes; + pPost.downvotes = response.data.vote.post.downvotes; }); } diff --git a/src/app/services/feed/feed.service.ts b/src/app/services/feed/feed.service.ts index 955cf2d..99217fe 100644 --- a/src/app/services/feed/feed.service.ts +++ b/src/app/services/feed/feed.service.ts @@ -168,7 +168,7 @@ export class FeedService { if (this.renderAllPosts(response).length < 1) { this.newPostsAvailable.next(false); } - this.newPosts.next(updatedPosts); + this.newPosts.next(updatedposts); this.setPost('NEW'); }); } else if (this.activePostList === 'TOP' && this.topPostsAvailable) {