Skip to content

Instantly share code, notes, and snippets.

@jneurock
Created October 11, 2018 13:04
Show Gist options
  • Save jneurock/2871c24f9f2a980832e5b3fde387f504 to your computer and use it in GitHub Desktop.
Save jneurock/2871c24f9f2a980832e5b3fde387f504 to your computer and use it in GitHub Desktop.
GraphQL Cart Items Example
import Route from '@ember/routing/route';
import getCart from 'my-app/gql/queries/get-cart';
export default Route.extend({
model(params) {
return this.get('apollo').query({
query: getCart,
variables: {
page: params.page,
pageSize: params.pageSize,
sort: params.sort
}
}
});
#import 'my-app/gql/fragments/address'
query($page: Int, $pageSize: Int, $sort: String) {
getCart {
items(page: $page, pageSize: $pageSize, sort: $sort) {
address {
...address
}
description
quantity
price
}
totalAmount
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment