Reactjs Apollo客户端-错误:在查询映射内找不到查询

Reactjs Apollo客户端-错误:在查询映射内找不到查询,reactjs,graphql,apollostack,react-apollo,apollo-client,Reactjs,Graphql,Apollostack,React Apollo,Apollo Client,我和阿波罗的客户有问题 我想在用户单击登录按钮时发送登录请求 我的代码是: // @vendors import React from 'react'; import { withApollo } from 'react-apollo'; import ApolloClient from 'apollo-client'; import gql from 'graphql-tag'; import { Link } from 'react-router'; class Login exte

我和阿波罗的客户有问题

我想在用户单击登录按钮时发送登录请求

我的代码是:

// @vendors
import React from 'react';
import { 
  withApollo
} from 'react-apollo';
import ApolloClient from 'apollo-client';
import gql from 'graphql-tag';
import { Link } from 'react-router';

class Login extends React.Component {

  constructor() {
    super();
    this.state = {
      email: 'user1@email.com'
    }
    this.sendRequest = this.sendRequest.bind(this);
  }

  sendRequest() {
    const {
      email
    } = this.state;

    const FETCH_USER = gql`
      query fetchUser($email: String!) {
        user(email: $email) {
          id
        }
      }
    `;
    return this.props.client.query({
      query: FETCH_USER,
      variables: {email: email}
    })
  }

  render() {
    return (
      <form>
        <div className="form-group">
          <label htmlFor="email">Email:</label>
          <input type="email" className="form-control" id="email" />
        </div>
        <div className="form-group">
          <label htmlFor="password">Password:</label>
          <input type="password" className="form-control" id="password" />
        </div>
        <button onClick={this.sendRequest} className="btn btn-default">Log In</button>
      </form>
    );
  }
}

Login.propTypes = {
  client: React.PropTypes.instanceOf(ApolloClient).isRequired,
}

export default withApollo(Login);
/@供应商
从“React”导入React;
导入{
阿波罗
}从‘阿波罗反应’;
从“apollo客户端”导入apollo客户端;
从“graphql标签”导入gql;
从“反应路由器”导入{Link};
类登录扩展了React.Component{
构造函数(){
超级();
此.state={
电邮:'user1@email.com'
}
this.sendRequest=this.sendRequest.bind(this);
}
sendRequest(){
常数{
电子邮件
}=本州;
const FETCH_USER=gql`
查询fetchUser($email:String!){
用户(电子邮件:$email){
身份证件
}
}
`;
返回this.props.client.query({
查询:获取用户,
变量:{email:email}
})
}
render(){
返回(
电邮:
密码:
登录
);
}
}
Login.propTypes={
客户端:React.PropTypes.instanceOf(ApolloClient).isRequired,
}
使用Apollo(登录)导出默认值;
控制台显示:

未捕获(承诺中)错误:网络错误:在查询映射内找不到查询

有人能帮我吗

更新:

我使用了以下版本:

  • “阿波罗客户端”:“^0.6.0”
  • “反应阿波罗”:“^0.9.0”