变异命令无效,但查询正常

时间:2019-09-04 05:36:30

标签: reactjs graphql apollo-client aws-appsync

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"}}}

0 个答案:

没有答案