Update frontend

- to work with new backend implementation
This commit is contained in:
Matt Rider 2019-04-17 12:51:50 -03:00
parent 4dc39a97a8
commit 86d075292c
2 changed files with 4 additions and 38 deletions

View File

@ -1,18 +0,0 @@
import gql from 'graphql-tag'
export default app => {
return {
AddPostComments: gql(`
mutation($from: _CommentInput!, $to: _PostInput!) {
AddPostComments(from: $from, to: $to) {
from {
id
}
to {
id
}
}
}
`)
}
}

View File

@ -321,38 +321,22 @@ export default {
this.$apollo
.mutate({
mutation: gql`
mutation($content: String!) {
CreateComment(content: $content) {
mutation($postId: ID, $content: String!) {
CreateComment(postId: $postId, content: $content) {
id
content
}
}
`,
variables: {
postId: this.post.id,
content: this.value
}
})
.then(res => {
this.disabled = true
this.loading = false
const { id } = res.data.CreateComment
const commentId = { id: id }
const postId = { id: this.post.id }
const AddPostComments = require('~/graphql/AddPostComments.js').default(
this
)
this.$apollo
.mutate({
mutation: AddPostComments.AddPostComments,
variables: {
from: commentId,
to: postId
}
})
.then(res => {
this.$toast.success('Saved!')
})
this.$toast.success('Saved!')
})
.catch(err => {
this.$toast.error(err.message)