Sam Jackson
05/25/2018, 3:54 AMRaeesaa
05/25/2018, 5:16 AMSam Jackson
05/25/2018, 5:17 AMVue-Apollo
.
submitPost () {
const body = <http://this.post|this.post>
this.$apollo.mutate({
mutation: api.posts.mutations.addPost,
variables: {
body,
parentId: null
}
}).then(response => {
console.log(response)
}).catch(error => {
console.log(error)
}).finally(() => {
<http://this.post|this.post> = ''
})
}
Sam Jackson
05/25/2018, 5:18 AMconst addPost = gql`
mutation AddPost ($body: String!, $parentId: String) {
addPost (
body: $body
parentId: $parentId
) {
id
body
parentId
}
}
`
Raeesaa
05/25/2018, 5:25 AMSam Jackson
05/25/2018, 5:29 AMSam Jackson
05/25/2018, 5:29 AMnilan
05/25/2018, 5:55 AMSam Jackson
05/25/2018, 5:59 AMnilan
05/25/2018, 6:02 AMnilan
05/25/2018, 6:02 AMSam Jackson
05/25/2018, 6:05 AMnull
in that above example? I’ve tried omitting that field completely to no avail, but omitting / passing null
also works in Playground.nilan
05/25/2018, 6:07 AMSam Jackson
05/25/2018, 2:00 PM$parentId
as a String
when it was supposed to be an ID
.nilan
05/25/2018, 2:00 PMnilan
05/25/2018, 2:01 PMSam Jackson
05/25/2018, 2:04 PMSam Jackson
05/25/2018, 2:05 PMnilan
05/25/2018, 2:05 PMSam Jackson
05/25/2018, 2:06 PMnilan
05/25/2018, 2:06 PM