diff --git a/webapp/components/comments/EditCommentForm/EditCommentForm.vue b/webapp/components/comments/EditCommentForm/EditCommentForm.vue index 10c7d457c..e647131b8 100644 --- a/webapp/components/comments/EditCommentForm/EditCommentForm.vue +++ b/webapp/components/comments/EditCommentForm/EditCommentForm.vue @@ -27,6 +27,7 @@ import gql from 'graphql-tag' import HcEditor from '~/components/Editor/Editor' import { mapMutations } from 'vuex' +import CommentMutations from '~/graphql/CommentMutations.js' export default { components: { @@ -67,14 +68,7 @@ export default { this.disabled = true this.$apollo .mutate({ - mutation: gql` - mutation($content: String!, $id: ID!) { - UpdateComment(content: $content, id: $id) { - id - content - } - } - `, + mutation: CommentMutations().UpdateComment, variables: { content: this.form.content, id: this.comment.id, @@ -96,12 +90,14 @@ export default { apollo: { User: { query() { - return gql(`{ - User(orderBy: slug_asc) { - id - slug + return gql` + { + User(orderBy: slug_asc) { + id + slug + } } - }`) + ` }, result({ data: { User } }) { this.users = User diff --git a/webapp/graphql/CommentMutations.js b/webapp/graphql/CommentMutations.js index e47e25d6a..6b0f653fc 100644 --- a/webapp/graphql/CommentMutations.js +++ b/webapp/graphql/CommentMutations.js @@ -20,5 +20,14 @@ export default () => { } } `, + UpdateComment: gql` + mutation($content: String!, $id: ID!) { + UpdateComment(content: $content, id: $id) { + id + content + contentExcerpt + } + } + `, } } diff --git a/webapp/graphql/CommentQuery.js b/webapp/graphql/CommentQuery.js index 3696f1964..4d82165f0 100644 --- a/webapp/graphql/CommentQuery.js +++ b/webapp/graphql/CommentQuery.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag' export default app => { const lang = app.$i18n.locale().toUpperCase() - return gql(` + return gql` query Comment($postId: ID) { Comment(postId: $postId) { id @@ -30,5 +30,5 @@ export default app => { } } } - `) + ` } diff --git a/webapp/graphql/PostQuery.js b/webapp/graphql/PostQuery.js index cac80d9b1..d2bba23ef 100644 --- a/webapp/graphql/PostQuery.js +++ b/webapp/graphql/PostQuery.js @@ -2,7 +2,7 @@ import gql from 'graphql-tag' export default i18n => { const lang = i18n.locale().toUpperCase() - return gql(` + return gql` query Post($slug: String!) { Post(slug: $slug) { id @@ -73,12 +73,12 @@ export default i18n => { shoutedByCurrentUser } } - `) + ` } export const filterPosts = i18n => { const lang = i18n.locale().toUpperCase() - return gql(` + return gql` query Post($filter: _PostFilter, $first: Int, $offset: Int) { Post(filter: $filter, first: $first, offset: $offset) { id @@ -118,5 +118,5 @@ export const filterPosts = i18n => { shoutedCount } } -`) +` }