Update the contentExcerpt

Co-Authored-By: mattwr18 <mattwr18@gmail.com>
This commit is contained in:
Wolfgang Huß 2019-07-16 15:48:38 +02:00
parent e4fd7f4cf7
commit 3b88c47206
4 changed files with 24 additions and 19 deletions

View File

@ -27,6 +27,7 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
import HcEditor from '~/components/Editor/Editor' import HcEditor from '~/components/Editor/Editor'
import { mapMutations } from 'vuex' import { mapMutations } from 'vuex'
import CommentMutations from '~/graphql/CommentMutations.js'
export default { export default {
components: { components: {
@ -67,14 +68,7 @@ export default {
this.disabled = true this.disabled = true
this.$apollo this.$apollo
.mutate({ .mutate({
mutation: gql` mutation: CommentMutations().UpdateComment,
mutation($content: String!, $id: ID!) {
UpdateComment(content: $content, id: $id) {
id
content
}
}
`,
variables: { variables: {
content: this.form.content, content: this.form.content,
id: this.comment.id, id: this.comment.id,
@ -96,12 +90,14 @@ export default {
apollo: { apollo: {
User: { User: {
query() { query() {
return gql(`{ return gql`
User(orderBy: slug_asc) { {
id User(orderBy: slug_asc) {
slug id
slug
}
} }
}`) `
}, },
result({ data: { User } }) { result({ data: { User } }) {
this.users = User this.users = User

View File

@ -20,5 +20,14 @@ export default () => {
} }
} }
`, `,
UpdateComment: gql`
mutation($content: String!, $id: ID!) {
UpdateComment(content: $content, id: $id) {
id
content
contentExcerpt
}
}
`,
} }
} }

View File

@ -2,7 +2,7 @@ import gql from 'graphql-tag'
export default app => { export default app => {
const lang = app.$i18n.locale().toUpperCase() const lang = app.$i18n.locale().toUpperCase()
return gql(` return gql`
query Comment($postId: ID) { query Comment($postId: ID) {
Comment(postId: $postId) { Comment(postId: $postId) {
id id
@ -30,5 +30,5 @@ export default app => {
} }
} }
} }
`) `
} }

View File

@ -2,7 +2,7 @@ import gql from 'graphql-tag'
export default i18n => { export default i18n => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql(` return gql`
query Post($slug: String!) { query Post($slug: String!) {
Post(slug: $slug) { Post(slug: $slug) {
id id
@ -73,12 +73,12 @@ export default i18n => {
shoutedByCurrentUser shoutedByCurrentUser
} }
} }
`) `
} }
export const filterPosts = i18n => { export const filterPosts = i18n => {
const lang = i18n.locale().toUpperCase() const lang = i18n.locale().toUpperCase()
return gql(` return gql`
query Post($filter: _PostFilter, $first: Int, $offset: Int) { query Post($filter: _PostFilter, $first: Int, $offset: Int) {
Post(filter: $filter, first: $first, offset: $offset) { Post(filter: $filter, first: $first, offset: $offset) {
id id
@ -118,5 +118,5 @@ export const filterPosts = i18n => {
shoutedCount shoutedCount
} }
} }
`) `
} }