我开始使用 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;
我不断收到错误:
'SignupUserInput!' 类型的变量 '$input_0' 预期值 但得到:{"email":"fdadsffd@fasdf.at","password":"@fdsad","clientMutationId":"1"}。原因:输入类型“SignupUserInput”中未定义未知字段“电子邮件”。(第 1 行,第 29 列):↵mutation SignupUserMutation($input_0:SignupUserInput!) {
我在这里做错了什么?