【发布时间】:2019-09-29 02:37:58
【问题描述】:
我尝试从我的 react 应用程序中调用 graphql 突变,但没有得到任何响应。
在操场上我的变异起作用了
这就是我所说的突变:
async getValues(values) {
const mutation = await this.props.mutate({
variables: {
name: values.username,
email: values.email,
password: values.password
}});
}
这是我的突变:
const registerMutation = gql`
mutation($name: String!, $email: String!, $password: String!) {
register(name: $name, email: $email, password: $password) {
ok
error
}
}
`;
我确定调用了函数 getValues 并且 this.props.mutate 是一个函数,但我没有得到任何响应
【问题讨论】:
-
展示如何在 reactjs 中调用 registerMutation