diff --git a/src/app/services/chat/chat.service.ts b/src/app/services/chat/chat.service.ts index bc5e281..e96543b 100644 --- a/src/app/services/chat/chat.service.ts +++ b/src/app/services/chat/chat.service.ts @@ -229,8 +229,8 @@ export class ChatService { } getBodyForSendMessage(pchatID: number, pContent: string) { - const body = {query: `mutation($chatID: ID!, $content: String!) { - sendMessage(chatId: $chatID, content: $content) {id} + const body = {query: `mutation($chatId: ID!, $content: String!) { + sendMessage(chatId: $chatId, content: $content) {id} }`, variables: { chatId: pchatID, content: pContent diff --git a/src/app/services/feed/feed.service.ts b/src/app/services/feed/feed.service.ts index d22df0e..8c8287f 100644 --- a/src/app/services/feed/feed.service.ts +++ b/src/app/services/feed/feed.service.ts @@ -78,7 +78,7 @@ export class FeedService { let headers = new Headers() headers.set('Content-Type', 'application/json') - this.http.post(url, this.getBodyForGetAllChats()) + this.http.post(url, this.getBodyForGetAllPosts()) .subscribe(response => { this.posts = this.renderAllPosts(response.json()) console.log(response) @@ -92,10 +92,10 @@ export class FeedService { let headers = new Headers() headers.set('Content-Type', 'application/json') - return this.http.post(url, this.getBodyForGetAllChats()) + return this.http.post(url, this.getBodyForGetAllPosts()) } - getBodyForGetAllChats() { + getBodyForGetAllPosts() { const body = {query: `query { getPosts (first: 1000, offset: 0) {id, content, htmlContent, upvotes, downvotes, author{name, handle, id}, createdAt} }` @@ -113,7 +113,7 @@ export class FeedService { let upvotes: number = post.upvotes let downvotes: number = post.downvotes let author = new Author(post.author.id, post.author.name, post.author.handle) - let date = post.createdAt + let date = new Date(post.createdAt).toDateString() posts.push(new Post(id, content, htmlContent, upvotes, downvotes, date, author)) }