Created
October 11, 2018 13:04
-
-
Save jneurock/2871c24f9f2a980832e5b3fde387f504 to your computer and use it in GitHub Desktop.
GraphQL Cart Items 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 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 | |
} | |
} | |
}); |
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/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