Created
October 11, 2018 13:26
-
-
Save jneurock/67901a119b9e2fbe55734d858e15e894 to your computer and use it in GitHub Desktop.
Update Cart Items GraphQL Example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Controller from '@ember/controller'; | |
import updateCartItems from 'my-app/gql/mutations/update-cart-items'; | |
export default Controller.extend({ | |
actions: { | |
updateCartItemsAddress(cartId, address) { | |
this.get('apollo').mutate({ | |
mutation: updateCartItems, | |
variables: { cartId, | |
attrs: { address } | |
} | |
}).catch(() => { | |
// Now a bit easier to deal with | |
}); | |
} | |
} | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import 'my-app/gql/fragments/cart-item' | |
mutation($cartId: ID!, $attrs: CartItemInput!) { | |
updateCartItems(cartId: $cartId, attrs: $attrs) { | |
...cartItem | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment