我想寫與可選的過濾器一個簡單的查詢參數Graphql可選操作變量
例如
const query = gql`query FilteredPeople($email: String) {
people(email: $email) {
fullName
email
}
}`;
我不斷收到
"Network error: The inline argument "email" is expected as a variable but was not provided."
這讓我覺得這是在服務器上方面,但我的模式是非常簡單的
const RootQuery = `
type RootQuery {
people(email: String): [Person]
}
`;
查看graphql規範以指定某些內容是否可選,請使用!
。正如你所看到的電子郵件不是必需的。
注意我正在使用apollo客戶端/服務器和react-apollo。我的版本
server
"graphql": "^0.7.2",
"graphql-server-express": "^0.4.3",
client
"apollo-client": "0.5.0",
"graphql-tag": "0.1.15",
"react-apollo": "0.5.16",
我錯過了什麼嗎?我以爲我解決了它,但它停止工作,所以我猜不是。