如何在反应js中将graphql列表传递给apollo中的变异

时间:2017-07-08 09:49:16

标签: reactjs graphql apollo mutation

我有这样的突变:

inline
graphql 中的

我希望在反应js Apollo 中将参数传递给它 像这样:

orderAdd(products: [ProductInput],restaurant: RestaurantInput)

但它不起作用我认为 graphql 列表的问题因为参数产品是类型   mutation orderAdd ($products: [ProductInput]!, $restaurant: RestaurantInput!) { orderAdd(products: $products, restaurant: $restaurant) { errors order { id createdAt products { id name price quantity totalPrice } rate { speed service flavor } } } } ; , 请告诉我如何将 graphql 列表传递给 apollo 中的变种?

1 个答案:

答案 0 :(得分:0)

您可以像这样传递突变列表



orderAdd(products: [{ProductInput1},{ProductInput2}],restaurant: RestaurantInput){.. }




希望,这会对你有帮助。