diff --git a/webapp/graphql/AddPostComments.js b/webapp/graphql/AddPostComments.js deleted file mode 100644 index ab9ef8ca5..000000000 --- a/webapp/graphql/AddPostComments.js +++ /dev/null @@ -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 - } - } - } - `) - } -} diff --git a/webapp/pages/post/_id/_slug/index.vue b/webapp/pages/post/_id/_slug/index.vue index ef1121031..95295d6bf 100644 --- a/webapp/pages/post/_id/_slug/index.vue +++ b/webapp/pages/post/_id/_slug/index.vue @@ -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)