无法在查询Apollo客户端上查询字段“书”

时间:2020-04-15 03:27:31

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

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

1 个答案:

答案 0 :(得分:0)

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