Use auto-cache update for content block mutations
This commit is contained in:
parent
0c2cab4c96
commit
c9d43dd111
|
|
@ -13,10 +13,13 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import CHANGE_CONTENT_BLOCK_MUTATION from '@/graphql/gql/mutations/mutateContentBlock.gql';
|
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 Checkbox from '@/components/Checkbox';
|
||||||
import {userGroupsQuery} from '@/helpers/user-groups'
|
import {userGroupsQuery} from '@/helpers/user-groups'
|
||||||
|
|
||||||
|
// import store from '@/store/index';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
props: ['show', 'content-block'],
|
props: ['show', 'content-block'],
|
||||||
|
|
||||||
|
|
@ -51,9 +54,15 @@
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
update: (store, {data: {mutateContentBlock: {contentBlock}}}) => {
|
// refetchQueries: [{
|
||||||
this.$store.dispatch('updateContentBlocks');
|
// 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!) {
|
query ModulesQuery($slug: String!) {
|
||||||
modules(slug: $slug) {
|
modules(slug: $slug) {
|
||||||
edges {
|
edges {
|
||||||
|
|
@ -32,19 +33,7 @@ query ModulesQuery($slug: String!) {
|
||||||
contentBlocks {
|
contentBlocks {
|
||||||
edges {
|
edges {
|
||||||
node {
|
node {
|
||||||
id
|
...ContentBlockParts
|
||||||
slug
|
|
||||||
title
|
|
||||||
type
|
|
||||||
contents
|
|
||||||
hiddenFor {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,40 +1,9 @@
|
||||||
|
#import "../fragments/contentBlockParts.gql"
|
||||||
mutation MutateContentBlock($input: MutateContentBlockInput!) {
|
mutation MutateContentBlock($input: MutateContentBlockInput!) {
|
||||||
mutateContentBlock(input: $input) {
|
mutateContentBlock(input: $input) {
|
||||||
contentBlock {
|
contentBlock {
|
||||||
id
|
...ContentBlockParts
|
||||||
title
|
|
||||||
slug
|
|
||||||
hiddenFor {
|
|
||||||
edges {
|
|
||||||
node {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
errors
|
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