mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2025-12-13 07:46:06 +00:00
- by pushing to the post.comments array, which updates the array, but doesn't rerender the comments component - by updating the apollo store as seen here https://akryum.github.io/vue-apollo/guide/apollo/mutations.html#server-side-example and https://github.com/Akryum/vue-apollo-todos
25 lines
479 B
JavaScript
25 lines
479 B
JavaScript
import faker from 'faker'
|
|
import uuid from 'uuid/v4'
|
|
|
|
export default function (params) {
|
|
const {
|
|
id = uuid(),
|
|
postId = 'p6',
|
|
content = [
|
|
faker.lorem.sentence(),
|
|
faker.lorem.sentence()
|
|
].join('. ')
|
|
} = params
|
|
|
|
return {
|
|
mutation: `
|
|
mutation($id: ID!, $postId: ID, $content: String!) {
|
|
CreateComment(id: $id, postId: $postId, content: $content) {
|
|
id
|
|
}
|
|
}
|
|
`,
|
|
variables: { id, postId, content }
|
|
}
|
|
}
|