account-js GraphQL 客户端验证突变不起作用

时间:2021-03-16 23:19:11

标签: javascript apollo-client apollo-server graphql-js

在 Apollo GraphQL 游乐场中,我有以下变化:

mutation {
  authenticate(
    serviceName: "password"
    params: {
      user: { email: "john.doe@john.com" }
      password: "superSecurePassword"
    }
  ) {
    sessionId
    tokens {
      accessToken
      refreshToken
    }
    user {
      id
    }
  }
}

客户端我尝试以下操作:

export const LOGIN_USER = gql`
  mutation Authenticate($email: String!, $password: String!) {
    authenticate(email: $email, password: $password) {
      id
      token
    }
  }
`;

抛出异常:

 46 | // Constructs an instance of ApolloError given a GraphQLError
 47 | // or a network error. Note that one of these has to be a valid
 48 | // value or the constructed error will be meaningless.

我哪里出错了?

1 个答案:

答案 0 :(得分:0)

试试这个

导出 const LOGIN_USER = gqlparent;