diff --git a/src/app/components/feed/feed.component.ts b/src/app/components/feed/feed.component.ts
index 1163804..848818e 100644
--- a/src/app/components/feed/feed.component.ts
+++ b/src/app/components/feed/feed.component.ts
@@ -27,6 +27,7 @@ export class FeedComponent implements OnInit {
this.feedNew = this.feedService.renderAllPosts(response.json())
this.parentSelectedPostList = this.feedNew
this.feedMostLiked = this.feedNew
+ console.log(this.feedNew)
})
}
diff --git a/src/app/components/feed/postlist/postlist.component.html b/src/app/components/feed/postlist/postlist.component.html
index ce02848..3a902e3 100644
--- a/src/app/components/feed/postlist/postlist.component.html
+++ b/src/app/components/feed/postlist/postlist.component.html
@@ -35,9 +35,15 @@
-
+
{{post.upvotes}}
-
+
{{post.downvotes}}
\ No newline at end of file
diff --git a/src/app/models/post.ts b/src/app/models/post.ts
index 27a7d8b..9036448 100644
--- a/src/app/models/post.ts
+++ b/src/app/models/post.ts
@@ -7,14 +7,16 @@ export class Post {
date: string
upvotes: number
downvotes: number
+ userVote: string
author: Author
- constructor(pId: number, pContent: string, pHtmlContent: string, pUpvotes: number, pDownvotes: number, pDate: string, pAuthor: Author) {
+ constructor(pId: number, pContent: string, pHtmlContent: string, pUpvotes: number, pDownvotes: number, pUserVote: string, pDate: string, pAuthor: Author) {
this.id = pId
this.content = pContent
this.htmlContent = pHtmlContent
this.upvotes = pUpvotes
this.downvotes = pDownvotes
+ this.userVote = pUserVote
this.date = pDate
this.author = pAuthor
}
diff --git a/src/app/services/feed/feed.service.ts b/src/app/services/feed/feed.service.ts
index 65c1e4a..f0bb6ed 100644
--- a/src/app/services/feed/feed.service.ts
+++ b/src/app/services/feed/feed.service.ts
@@ -97,7 +97,7 @@ export class FeedService {
getBodyForGetAllPosts() {
const body = {query: `query {
- getPosts (first: 1000, offset: 0) {id, content, htmlContent, upvotes, downvotes, author{name, handle, id}, createdAt}
+ getPosts (first: 1000, offset: 0) {id, content, htmlContent, upvotes, downvotes, userVote, author{name, handle, id}, createdAt}
}`
}
@@ -113,11 +113,12 @@ export class FeedService {
let htmlContent: string = post.htmlContent
let upvotes: number = post.upvotes
let downvotes: number = post.downvotes
+ let userVote: string = post.userVote
let author = new Author(post.author.id, post.author.name, post.author.handle)
let temp = new Date(Number(post.createdAt))
let date = temp.toLocaleString("en-GB")
- posts.push(new Post(id, content, htmlContent, upvotes, downvotes, date, author))
+ posts.push(new Post(id, content, htmlContent, upvotes, downvotes, userVote, date, author))
}
return posts
}