Merge branch 'niklas_dev2' of Software_Engineering_I/greenvironment-frontend into master

master
Niklas_L 5 years ago committed by Gitea
commit 3c8418bc8f

@ -81,3 +81,11 @@
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

@ -19,13 +19,13 @@ export class PostlistComponent implements OnInit {
} }
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)})
} }
} }

@ -229,7 +229,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