diff options
Diffstat (limited to 'frontend/components/AddToCart.js')
| -rw-r--r-- | frontend/components/AddToCart.js | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/frontend/components/AddToCart.js b/frontend/components/AddToCart.js index c79e644..7cb0856 100644 --- a/frontend/components/AddToCart.js +++ b/frontend/components/AddToCart.js @@ -1,5 +1,5 @@ import { Component } from 'react'; -import { Mutation, Query } from 'react-apollo'; +import { Mutation } from 'react-apollo'; import PropTypes from 'prop-types'; import { ADD_TO_CART_MUTATION, @@ -34,21 +34,17 @@ class AddToCart extends Component { render() { const { id } = this.props; return ( - <Query query={CURRENT_USER_QUERY}> - {() => ( - <Mutation - mutation={ADD_TO_CART_MUTATION} - variables={{ id }} - update={this.update} - > - {(addToCart, { loading }) => ( - <button disabled={loading} onClick={addToCart}> - 🛒 Add{loading && 'ing'} To Cart - </button> - )} - </Mutation> + <Mutation + mutation={ADD_TO_CART_MUTATION} + variables={{ id }} + update={this.update} + > + {(addToCart, { loading }) => ( + <button disabled={loading} onClick={addToCart}> + 🛒 Add{loading && 'ing'} To Cart + </button> )} - </Query> + </Mutation> ); } } |
