我想在graphQL查询中发送对象数组。但是我不知道如何在查询$ alerts中键入指针:
所以我的问题是有人可以向我们解释清楚如何使其工作。 从头到尾,这是我要获取的代码,下面的代码是我的代码的工作方式。
已经预先感谢
//
const ADDALERT = gql`
mutation($id:ID!){
editAd(
id:$id,
alerts:[
{
id:"9sadasd",
specifications:[["asdasdda99","asd2"],["asdasdads3","4asdsadd"]],
images:["alersdasdasadasdst123","alert1asdsasdasddad23"],
text:"1adsasdsada3"
}
]
){
id
}
}
`
//////////////////////////////////////////////////////////////
//i do not know the implementation of [ ???? !]! below
const ADDALERT = gql`
mutation($id:ID!, $alerts:[ ???? !]!){
editAd( id:$id, alerts:$alerts){
id
}
}
<Mutation
mutation={ADDALERT}
variables={ id:"5d9b6be61c9d440000fca5fd",
alerts:[{
id:"9sadasd",
specifications:[["asdasdda99","asd2"],["asdasdads3","4asdsadd"]],
images:["alersdasdasadasdst123","alert1asdsasdasddad23"],
text:"1adsasdsada3"
}]}
onCompleted={() => {alert(`Thanks , we will Work on It !`)}}
>
{postMutation => <button
className="button_addalert"
onClick={postMutation}><b>Submit</b>
</button>}
</Mutation>
`