diff options
| author | Wes Bos <wesbos@gmail.com> | 2017-09-21 15:39:12 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2017-09-21 15:39:12 -0400 |
| commit | 3b45dd7b593825721ec9ee9f6a49c732601b1ae0 (patch) | |
| tree | a2e8e73d6b6b6bc32eda2bb79af817397e4304f5 /queries | |
| parent | 1450e579c67e3d969cb099dfe6c1cefd1e313fb5 (diff) | |
Cha Ching
Diffstat (limited to 'queries')
| -rw-r--r-- | queries/index.js | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/queries/index.js b/queries/index.js index 9b11bb8..bc64d0e 100644 --- a/queries/index.js +++ b/queries/index.js @@ -1,4 +1,4 @@ -import { gql } from 'react-apollo' +import { gql } from 'react-apollo'; import { itemDetails } from './fragments'; export const CREATE_LINK_MUTATION = gql` @@ -13,25 +13,21 @@ export const CREATE_LINK_MUTATION = gql` ...itemDetails } } -` +`; export const CREATE_USER_MUTATION = gql` mutation CreateUserMutation($email: String!, $name: String!, $idToken: String!) { - createUser( - email: $email, - name: $name, - authProvider: { auth0: { idToken: $idToken } } - ) { - id, - email, - name, + createUser(email: $email, name: $name, authProvider: { auth0: { idToken: $idToken } }) { + id + email + name cart { id title } } } -` +`; export const CREATE_ORDER_MUTATION = gql` mutation CreateOrderMutation($token: String!, $userId: ID!, $itemId: ID!) { @@ -53,7 +49,6 @@ export const CREATE_ORDER_MUTATION = gql` } `; - export const ALL_ITEMS_QUERY = gql` # Import the Fragment ${itemDetails} @@ -65,7 +60,7 @@ export const ALL_ITEMS_QUERY = gql` ...itemDetails } } -` +`; export const SINGLE_ITEM_QUERY = gql` ${itemDetails} @@ -90,16 +85,15 @@ export const SEARCH_ITEMS_QUERY = gql` } `; - export const DELETE_ITEM_MUTATION = gql` mutation DelteItem($id: ID!) { deleteItem(id: $id) { - id, - title, + id + title description } } -` +`; export const UPDATE_LINK_MUTATION = gql` ${itemDetails} @@ -114,7 +108,7 @@ export const UPDATE_LINK_MUTATION = gql` ...itemDetails } } -` +`; export const CURRENT_USER_QUERY = gql` query userQuery { @@ -137,15 +131,18 @@ export const CURRENT_USER_QUERY = gql` export const USER_ORDERS_QUERY = gql` query { - user { # grab the current user + user { + # grab the current user id - orders { # and a all their orders + orders { + # and a all their orders id amount charge - item { # populate the details about the item they bought with the image, description and title + item { + # populate the details about the item they bought with the image, description and title image { - id, + id secret } description @@ -158,7 +155,7 @@ export const USER_ORDERS_QUERY = gql` export const ADD_TO_CART_MUTATION = gql` mutation AddToCart($userId: ID!, $itemId: ID!) { - addToCartItems(userUserId:$userId, cartItemId: $itemId) { + addToCartItems(userUserId: $userId, cartItemId: $itemId) { cartItem { id title @@ -170,7 +167,7 @@ export const ADD_TO_CART_MUTATION = gql` export const REMOVE_FROM_CART_MUTATION = gql` mutation xxx($userId: ID!, $itemId: ID!) { - removeFromCartItems(userUserId:$userId, cartItemId: $itemId) { + removeFromCartItems(userUserId: $userId, cartItemId: $itemId) { cartItem { id title |
