尝试运行React应用后,出现以下错误:
“ GraphQLError:语法错误:预期名称,找到了[”
错误引用的具体突变是:
import gql from "graphql-tag";
export default gql(`
mutation($name: String!, $address: String!, $phoneNumber: String!,
$allegedOffenses: String!, $courtDates: [AWSDate]!) {
createClient(
name: $name,
address: $address,
phoneNumber: $phoneNumber,
allegedOffenses: $allegedOffenses,
courtDates: $[AWSDate]
) {
id,
name,
address,
phoneNumber,
allegedOffenses,
courtDates,
comments {
items {
commentId
}
}
}
}`);
我尝试使用here中的故障排除步骤,但没有任何运气。有什么想法吗?
答案 0 :(得分:0)
O(n)
参数突变中的错字。
courtDates
应为:
createClient(
name: $name,
address: $address,
phoneNumber: $phoneNumber,
allegedOffenses: $allegedOffenses,
courtDates: $[AWSDate]
)