简体   繁体   English

GraphQLError:语法错误:预期名称,找到<EOF>

[英]GraphQLError: Syntax Error: Expected Name, found <EOF>

I got the above error on a graphql query, I am using apollo-react by the way and using the Query component for rendering the data我在 graphql 查询中遇到了上述错误,顺便说一下,我正在使用 apollo-react 并使用 Query 组件来呈现数据

this is my code这是我的代码

const GET_VEHICLE_CHECKS = gql`
query getVehicleChecks($uuid: String!) {
  tripDetails(uuid: $uuid){
    departmentAssigned{
      vehicleChecks{
        conditions{
          id
          name
          standard
          valueType
          spinnerItems
        }
      }
    }
  }

`;

and this is what my actual query looks like这就是我实际查询的样子

{
  tripDetails(uuid: "c0e7233093b14afa96f39e2b70c047d8"){
    departmentAssigned{
      vehicleChecks{
        conditions{
          id
          name
          standard
          valueType
          spinnerItems
        }
      }
    }
    vehicleConditions{
      id
      condition{
        id
        standard
      }
      value
    }
  }
}

I tried changing variable names, but that didn't work我尝试更改变量名称,但这不起作用

You are missing a closing bracket } at the end of your query.您在查询的末尾缺少一个右括号}

const GET_VEHICLE_CHECKS = gql`
query getVehicleChecks($uuid: String!) {
  tripDetails(uuid: $uuid){
    departmentAssigned{
      vehicleChecks{
        conditions{
          id
          name
          standard
          valueType
          spinnerItems
        }
      }
    }
  }
} <- THIS
`;

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

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