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

时间:2019-07-02 08:04:20

标签: graphql react-apollo graphql-tag

我在graphql查询中遇到了以上错误,我正在顺便起诉apollo-react,并使用Query组件呈现数据

这是我的代码

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

`;

这就是我的实际查询结果

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

我尝试更改变量名称,但这没用

1 个答案:

答案 0 :(得分:1)

查询末尾您缺少右括号}

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