Fix votes not getting refreshed

master
trivernis 5 years ago
parent b15dc8e16b
commit 59994f3697

@ -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;
});
}

@ -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) {

Loading…
Cancel
Save