From 1c27f6d064f3d09d68af392511cdd827a4c080b8 Mon Sep 17 00:00:00 2001 From: lampe_n1 Date: Tue, 29 Oct 2019 17:17:02 +0100 Subject: [PATCH] Message sending and Date probably fixed --- src/app/services/chat/chat.service.ts | 4 ++-- src/app/services/feed/feed.service.ts | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/app/services/chat/chat.service.ts b/src/app/services/chat/chat.service.ts index b26b9b0..f3d9092 100644 --- a/src/app/services/chat/chat.service.ts +++ b/src/app/services/chat/chat.service.ts @@ -228,8 +228,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 46955d5..d847d34 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)) }