In the following example we have a mutation that create a post. This is a simple example with only 2 params, title and url. What if this post has a lot of arguments. Is there any other way to pass the params? Or only one by one. Can we pass o whole object?
newPost() {
this.apollo.mutate({
mutation: gql`mutation($title: String, $url: String) {
createPost(title: $title, url: $url) {
title
url
}
}
`,
variables: {
title: this.someForm.get('title'),
url: this.someForm.get('url')'
}
}).subscribe(data => {
console.log('New post created!', data);
});
}