简体   繁体   English

无法查询类型为 Query Apollo 客户端的字段“books”

[英]Cannot query field "books" on type Query Apollo client

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

✅Loading Apollo Project
✅Checking client: compatibility with service

I got this error:我收到此错误:

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


2 operations validated
2 failures

Any idea what am I doing wrong?知道我做错了什么吗?

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
      }
    }
    `
  }
)

I found the issue, my type query and type mutation did not have the correct data type on the back end side....我发现了问题,我的类型查询和类型突变在后端没有正确的数据类型....

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM