【发布时间】:2017-10-17 06:23:31
【问题描述】:
我正在使用 Apollo Client 和 React 制作一个简单的购物车,但我显示的从服务器检索到的总价格不是参考发送的最后一个请求,而是参考接收的最后一个请求。有没有办法使请求同步或类似的东西?甚至如何知道上次发送的突变的返回值是多少?
我的代码:
this.props.mutate({ variables: { input: {
lineItems: this.productCart
}}})
.then(({ data }) => {
this.setState({
subtotalPrice : data.manageCheckout.checkout.subtotalPrice
})
}).catch((error) => {
console.warn('there was an error sending the query', error)
})
【问题讨论】:
标签: reactjs graphql apollo react-apollo apollo-client