GraphQL查询工作正常,返回预期结果。但是变异命令不起作用,返回像null这样的值的对象,
{"data":{"create_event":{"event_id":null,"name":null,"__typename":"Event"}}}
aws-appsync,aws-appsync-react的版本分别为1.0.22、1.0.13
反应^ 16.8.6 react-apollo“ ^ 2.5.6”
const addEventMutation = gql`mutation addEvent($name: String!){
create_event(input:{name: $name}){
event_id
name
}
}`;
client.mutate({
mutation: addEventMutation,
variables: {
name: "Test"
}
}).then((data) => {
console.log(data);
}).catch(error => {
console.log(error)
})
这是我得到的结果:
{"data":{"create_event":{"event_id":null,"name":null,"__typename":"Event"}}}