diff options
| author | Wes Bos <wesbos@gmail.com> | 2018-02-13 13:19:23 -0500 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2018-02-13 13:19:23 -0500 |
| commit | fa3ec3299b3fa33e5a699683beb96cfa4e6dd51d (patch) | |
| tree | 601b4ff9650cd17a6d4181fc5982b401411d2a6a /frontend/queries | |
| parent | e0d0baa75ec0bf617f91b6cd779305d4009cae12 (diff) | |
getting there
Diffstat (limited to 'frontend/queries')
| -rw-r--r-- | frontend/queries/fragments.js | 1 | ||||
| -rw-r--r-- | frontend/queries/index.js | 33 |
2 files changed, 20 insertions, 14 deletions
diff --git a/frontend/queries/fragments.js b/frontend/queries/fragments.js index 1708d78..9a2d641 100644 --- a/frontend/queries/fragments.js +++ b/frontend/queries/fragments.js @@ -6,5 +6,6 @@ export const itemDetails = gql` title price description + image } `; diff --git a/frontend/queries/index.js b/frontend/queries/index.js index e61a9d5..365c6f4 100644 --- a/frontend/queries/index.js +++ b/frontend/queries/index.js @@ -3,8 +3,8 @@ import { itemDetails } from './fragments'; export const CREATE_ITEM_MUTATION = gql` ${itemDetails} - mutation createItem($description: String!, $title: String!, $price: Int!) { - createItem(description: $description, title: $title, price: $price) { + mutation createItem($description: String!, $title: String!, $price: Int!, $image: String) { + createItem(description: $description, title: $title, price: $price, image: $image) { ...itemDetails } } @@ -58,20 +58,14 @@ export const RESET_MUTATION = gql` `; export const CREATE_ORDER_MUTATION = gql` - mutation CreateOrderMutation($token: String!, $userId: ID!, $itemId: ID!) { - createOrder(token: $token, userId: $userId, itemId: $itemId) { + mutation CreateOrderMutation($token: String!) { + createOrder(token: $token) { id - token charge - amount - item { + total + items { id title - description - } - user { - id - email } } } @@ -85,8 +79,6 @@ export const ALL_ITEMS_QUERY = gql` pageInfo { hasNextPage hasPreviousPage - startCursor - endCursor } aggregate { count @@ -161,6 +153,11 @@ export const CURRENT_USER_QUERY = gql` id email name + orders { + charge + id + total + } cart { id quantity @@ -200,6 +197,14 @@ export const ADD_TO_CART_MUTATION = gql` mutation addToCart($id: ID!) { addToCart(id: $id) { id + quantity + item { + id + price + description + image + title + } } } `; |
