react-native - React Native GraphQL 使用 Apollo:将数组传递给突变输入
问题描述
我只是用 apollo 调用 api graph QL 几天
我只有一个简单的问题
如何将像变量一样的数组传递给突变
在我的代码第 7 行中,我想将“航点”数组传递给突变。
请!!!
const GET_QUOTATION = gql`
query($date: String!) {
getQuotation(
input: {
pickupTime: $date
serviceType: CAR
waypoints: [
{
type: PICKUP
address1: "Anson Road, #23-01"
address2: "079906"
location: {lat: "1.307274", lng: "103.883998"}
name: "Jack"
phone: "82187877"
}
]
}
) {
delivery {
provider
price
}
poolWindow {
price
window
}
}
}
`;
const [getQuotation, quotationData] = useLazyQuery(GET_QUOTATION, {
onCompleted() {
console.log('-> success');
},
onError() {
console.log('-> error');
},
variables: {
date: '2021-03-12T18:54:00Z',
},
});
解决方案
推荐阅读
- .net-core - EF Core 在迁移期间锁定数据库
- ruby-on-rails - 使用参数在简单表单上自动完成字段
- python - Python的并行处理
- html - 在角度 6 的标签中显示 json 值
- javascript - setState 不更新嵌套对象
- java - 如何从 Java 应用程序向 AngularJS 应用程序发送通知
- python - Python - 以空速速度进行基准测试 - 时间的表观量化
- swift - 有没有办法快速连接 var 的名称?
- sql-server - 如何在 sql server 中将 Gender 作为 MALE 和 FEMALE 分开,而 Gender 的数据类型是 INT
- python - 缺少智能感知,for 循环中的自动完成