Answer the question
In order to leave comments, you need to log in
How to form GraphQL queries with Input types?
Hello,
How to form GraphQL queries with Input types in Apollo Angular. Here's a code example:
addBlock(block: BlockData) {
return this.apollo
.mutate({
mutation: gql`
mutation Block {
add (block: BlockInput!) {
block
}
}
`
})
}
Answer the question
In order to leave comments, you need to log in
Did it like this:
addBlock(block: BlockContainer) {
return this.apollo
.mutate({
mutation: gql`
mutation Block($blockContainer: BlockDataInput!) {
add (blockData: $blockContainer) {
id
type
data
order
}
}
`,
variables: {
blockContainer: block
}
})
.map((d) => d.data.add);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question