Graphcool createUser Mutation的正确变异类代码是什么?

时间:2017-05-02 20:12:20

标签: reactjs relayjs relay graphcool

我开始使用Relay和GraphCool,并且无法使用Relay创建createUser Mutation。

这是我目前的代码:

import Relay from 'react-relay';

类SignupUserMutation扩展了Relay.Mutation {

getMutation() {
    return Relay.QL`
        mutation {
            createUser(input: {
                authProvider: {email: { email: $email, password: $password }},
                clientMutationId: "createuser1"
            }) {
                clientMutationId
            }
        }
    `;
}

getVariables() {
    return {
        email:    this.props.email,
        password: this.props.password
    };
}

getFatQuery() {
    return Relay.QL`
        fragment on CreateUserPayload {
            viewer { id }
        }
    `;
}

getConfigs() {
    return [{
        type:           'RANGE_ADD',
        parentName:     'viewer',
        parentID:       this.props.viewerId,
        connectionName: 'users',
        edgeName:       'usereEdge',
        rangeBehaviors: {
            '': 'append',
        },
    }];
}

}

export default SignupUserMutation;

我一直收到错误:

  

变量' $ input_0'类型' SignupUserInput的期望值!'但得到了:{"电子邮件":" fdadsffd@fasdf.at","密码":" @ fdsad"," clientMutationId& #34;:" 1"}。原因:未知字段'电子邮件'未在输入类型' SignupUserInput'中定义。 (第1行,第29列):↵mutationRandupUserMutation($ input_0:SignupUserInput!){

我在这里做错了什么?

0 个答案:

没有答案