【发布时间】:2019-01-23 10:30:28
【问题描述】:
这是我的 graphql 查询/突变。
我收到错误: GraphQLError:语法错误:预期 :,找到 {
不知道哪一个是错的。
import gql from 'graphql-tag';
export const CategoriesQuery = gql`
query categoriesQuery(
$id: ID!,
$country: String!,
$name: String!
) {
sections(
id: $id,
country: $country,
name: $description
) {
id,
createdBy,
createdDate,
lastUpdate,
name
}
}
`;
export const ItemsQuery = gql`
query itemsQuery(
$id: ID!,
$category: String!,
$url: String!,
$alias: String!,
$name: String!
) {
items(
input {
id: $id,
category: $category,
url: $url,
alias: $alias,
name: $name
}
) {
id,
createdBy,
createdDate,
lastUpdate,
name,
category,
url,
alias,
description
}
}
`;
export const AddCategoryMutation = gql`
mutation ($category: CategoryInput!) {
addCategory(category: $category) {
id
}
}
`;
export const AddItemMutation = gql`
mutation ($item: ItemInput!) {
addItem(item: $item){
id
}
}
`;
【问题讨论】: