Chat message sending and feed voting test

master
lampe_n1 5 years ago
parent c013e06ddf
commit d4e7d1ae27

@ -80,4 +80,12 @@
padding: 0.125em
resize: none
#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() {
}
voteUp(pPost: Post){
this.feedService.upvote(pPost.id)
this.voteEvent.emit(true)
voteUp(pPost: Post) {
this.feedService.upvote(pPost.id).subscribe(response => {
this.voteEvent.emit(true)})
}
voteDown(pPost: Post){
this.feedService.downvote(pPost.id)
this.voteEvent.emit(true)
voteDown(pPost: Post) {
this.feedService.downvote(pPost.id).subscribe(response => {
this.voteEvent.emit(true)})
}
}

@ -228,7 +228,7 @@ export class ChatService {
}
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}
}`, variables: {
chatId: pchatID,

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

Loading…
Cancel
Save