小编Mot*_*oad的帖子

“网络错误:尝试获取资源时出现NetworkError。”

我正在使用带有响应和阿波罗的graph.cool api。我正在使用graph.cools默认电子邮件传递集成构建身份验证系统。以某种方式登录突变可以完美地工作,但是寄存器突变不能工作。注意:登录和注册突变功能都在同一页面上。没有登录工作注册。

注册功能:

async register(){
await client.mutate({
mutation: gql`
   mutation createUser($email: String!, $password: String!){
    createUser(
      authProvider : {
        email: { 
          email: $email, 
          password: $password 
          }
      }
  ) {
    id
  }
}
`,

variables: {
  email: this.state.regEmail,
  password: this.state.regPass
},
})
.then(result => { this.props.history.push({
pathname: '/dashboard',
state: { logInfo: [result.data.signinUser.token, 
                result.data.signinUser.user.id] }
});
})
.catch(error => { console.log(error)});
}
Run Code Online (Sandbox Code Playgroud)

登录功能:

async login(){
 await client.mutate({
  mutation: gql`
     mutation signinUser($email: String!, $password: String!){
    signinUser(
      email: { email: $email, password: $password }
    ) …
Run Code Online (Sandbox Code Playgroud)

reactjs graphql react-apollo apollo-client

5
推荐指数
1
解决办法
527
查看次数

标签 统计

apollo-client ×1

graphql ×1

react-apollo ×1

reactjs ×1