【发布时间】:2023-03-17 17:31:01
【问题描述】:
我目前正在学习 GraphQL 和 Apollo 的 React,我有一个问题在网上找不到答案:
我已经完成了一个表单来为我的 mongoDB 发送数据,并且我有这个查询:
const addContactMutation = gql`
mutation($name: String!, $address: String!, $vat: Int!, $zip: String!, $email: String!, $contact: Int!){
addContact(name: $name, address: $address, vat: $vat, zip: $zip, email: $email, contact: $contact){
name
vat
email
}
}
`
但是,我的 $vat 和 $contact 是大数字,在提交表单时我收到此错误:
变量“$vat”得到无效值“232214336”;预期类型 Int。 int 不能表示非整数值
我应该使用哪种类型?
【问题讨论】:
标签: reactjs error-handling graphql react-apollo apollo-client