【问题标题】:Cannot query field "books" on type Query Apollo client无法在查询 Apollo 客户端类型上查询字段“书籍”
【发布时间】:2020-07-27 22:57:51
【问题描述】:

当运行 Apollo CLI 命令“apollo client:check --key="MyAPIKEYXX" --includes="./src/**/*.js"

✅Loading Apollo Project
✅Checking client: compatibility with service

我收到了这个错误:

Cannot query field "CreateBook" on type Mutation
Cannot query field "Books" on type Query


2 operations validated
2 failures

知道我做错了什么吗?

client.query(
  {
    query: gql`
       query Books{
        books {
          title
          author
        }
      }
    `,
  })
  .then((result) => console.log(result));

client.mutate(
  {
    mutation: gql`
    mutation CreatBook{
      createBook(input: 
      { title: "World"
      author: "De la ve"}){
       id
        title
        author
      }
    }
    `
  }
)

【问题讨论】:

  • 在操场上测试过?

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


【解决方案1】:

我发现了问题,我的类型查询和类型突变在后端没有正确的数据类型....

【讨论】:

    猜你喜欢
    • 2019-04-18
    • 2021-09-02
    • 2022-10-17
    • 2019-11-02
    • 1970-01-01
    • 2016-08-31
    • 2022-11-04
    • 2021-06-03
    • 2021-10-09
    相关资源
    最近更新 更多