Closed JimmyLv closed 5 years ago
query statements and Schema:
query orderProductsById($orderId: String!) { orderDetail(orderId: $orderId) { orderProducts { amount attribute count customReqDesc customReqImage groupId id <----------------- can't be null image isGift model returnableCount sellPrice skuId skuName } } }
Actually the orderProducts is an array and these items should has different values.
orderProducts: [OrderProduct]!
the apollo query option in Vue components:
apollo: { orderProducts: { query: orderProductsById, variables() { return { orderId: this.orderId, } }, update: data => data.orderDetail.orderProducts.map(p => ({ name: p.skuName, description: p.customReqDesc, skuCode: p.skuId, saleProperty: p.attribute, previewImage: p.image, quantity: p.count, price: p.amount, })), result({ data, loading, networkStatus }) { console.log('We got some result!', { data, loading, networkStatus, }) }, }, }
Fixed by removed the null id, the idea of solution here: https://github.com/Akryum/vue-apollo/issues/373
null
query statements and Schema:
Actually the orderProducts is an array and these items should has different values.
the apollo query option in Vue components: