Use auto-cache update for content block mutations
This commit is contained in:
parent
0c2cab4c96
commit
c9d43dd111
|
|
@ -13,10 +13,13 @@
|
|||
|
||||
<script>
|
||||
import CHANGE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
||||
// import MODULE_DETAILS_QUERY from '@/graphql/gql/moduleDetailsQuery.gql';
|
||||
|
||||
import Checkbox from '@/components/Checkbox';
|
||||
import {userGroupsQuery} from '@/helpers/user-groups'
|
||||
|
||||
// import store from '@/store/index';
|
||||
|
||||
export default {
|
||||
props: ['show', 'content-block'],
|
||||
|
||||
|
|
@ -51,9 +54,15 @@
|
|||
})
|
||||
}
|
||||
},
|
||||
update: (store, {data: {mutateContentBlock: {contentBlock}}}) => {
|
||||
this.$store.dispatch('updateContentBlocks');
|
||||
}
|
||||
// refetchQueries: [{
|
||||
// query: MODULE_DETAILS_QUERY,
|
||||
// variables: {
|
||||
// slug: store.state.moduleSlug
|
||||
// }
|
||||
// }]
|
||||
// update: (store, {data: {mutateContentBlock: {contentBlock}}}) => {
|
||||
// this.$store.dispatch('updateContentBlocks');
|
||||
// }
|
||||
});
|
||||
}
|
||||
},
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
fragment ContentBlockParts on ContentBlockNode {
|
||||
id
|
||||
slug
|
||||
title
|
||||
type
|
||||
contents
|
||||
hiddenFor {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,3 +1,4 @@
|
|||
#import "./fragments/contentBlockParts.gql"
|
||||
query ModulesQuery($slug: String!) {
|
||||
modules(slug: $slug) {
|
||||
edges {
|
||||
|
|
@ -32,19 +33,7 @@ query ModulesQuery($slug: String!) {
|
|||
contentBlocks {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
slug
|
||||
title
|
||||
type
|
||||
contents
|
||||
hiddenFor {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
...ContentBlockParts
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,9 @@
|
|||
#import "../fragments/contentBlockParts.gql"
|
||||
mutation MutateContentBlock($input: MutateContentBlockInput!) {
|
||||
mutateContentBlock(input: $input) {
|
||||
contentBlock {
|
||||
id
|
||||
title
|
||||
slug
|
||||
hiddenFor {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
name
|
||||
}
|
||||
}
|
||||
}
|
||||
...ContentBlockParts
|
||||
}
|
||||
errors
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
#// input
|
||||
#
|
||||
#{
|
||||
# "input": {
|
||||
# "id": "Q29udGVudEJsb2NrTm9kZToyMQ==",
|
||||
# "type": "plain",
|
||||
# "title": "Hallo Daniel"
|
||||
# }
|
||||
#}
|
||||
#
|
||||
#
|
||||
#{
|
||||
# "input": {
|
||||
# "id": "Q29udGVudEJsb2NrTm9kZToyMQ==",
|
||||
# "type": "plain",
|
||||
# "title": "Hallo Daniel",
|
||||
# "contents": "[{\"type\":\"text_block\",\"value\":{\"text\": \"<p>Beatae odio</p>\"}}]"
|
||||
# }
|
||||
#}
|
||||
|
|
|
|||
Loading…
Reference in New Issue