Chat message sending and feed voting test

master
lampe_n1 5 years ago
parent c013e06ddf
commit d4e7d1ae27

@ -80,4 +80,12 @@
padding: 0.125em padding: 0.125em
resize: none resize: none
#send #send
@include gridPosition(1, 2, 2, 3) @include gridPosition(1, 2, 2, 3)
button
background-color: $cFeedChooserBackground
color: $cFontWhite
border: none
border-radius: 0.5em
button:hover
background-color: lighten($cFeedChooserBackground, 10%)
cursor: pointer

@ -18,14 +18,14 @@ export class PostlistComponent implements OnInit {
ngOnInit() { ngOnInit() {
} }
voteUp(pPost: Post){ voteUp(pPost: Post) {
this.feedService.upvote(pPost.id) this.feedService.upvote(pPost.id).subscribe(response => {
this.voteEvent.emit(true) this.voteEvent.emit(true)})
} }
voteDown(pPost: Post){ voteDown(pPost: Post) {
this.feedService.downvote(pPost.id) this.feedService.downvote(pPost.id).subscribe(response => {
this.voteEvent.emit(true) this.voteEvent.emit(true)})
} }
} }

@ -228,7 +228,7 @@ export class ChatService {
} }
getBodyForSendMessage(pchatID: number, pContent: string) { getBodyForSendMessage(pchatID: number, pContent: string) {
const body = {query: `mutation($chatID: number, $content: string) { const body = {query: `mutation($chatID: ID!, $content: String!) {
sendMessage(chatId: $chatID, content: $content) {id} sendMessage(chatId: $chatID, content: $content) {id}
}`, variables: { }`, variables: {
chatId: pchatID, chatId: pchatID,

@ -42,7 +42,7 @@ export class FeedService {
console.log(response.text())}) console.log(response.text())})
} }
public upvote(pPostID: number): void { public upvote(pPostID: number): any {
let url = 'https://greenvironment.net/graphql' let url = 'https://greenvironment.net/graphql'
let headers = new Headers() let headers = new Headers()
@ -54,11 +54,10 @@ export class FeedService {
postId: pPostID postId: pPostID
}} }}
this.http.post(url, body).subscribe(response => { return this.http.post(url, body)
console.log(response.text())})
} }
public downvote(pPostID: number): void { public downvote(pPostID: number): any {
let url = 'https://greenvironment.net/graphql' let url = 'https://greenvironment.net/graphql'
let headers = new Headers() let headers = new Headers()
@ -70,8 +69,7 @@ export class FeedService {
postId: pPostID postId: pPostID
}} }}
this.http.post(url, body).subscribe(response => { return this.http.post(url, body)
console.log(response.text())})
} }
public getAllPosts(): Array<Post> { public getAllPosts(): Array<Post> {

Loading…
Cancel
Save