无法在查询Apollo客户端类型上查询字段“ books”

问题描述 投票:0回答:1

[运行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个回答
0
投票

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

© www.soinside.com 2019 - 2024. All rights reserved.