diff options
| author | Wes Bos <wesbos@gmail.com> | 2017-08-08 22:09:05 -0400 |
|---|---|---|
| committer | Wes Bos <wesbos@gmail.com> | 2017-08-08 22:09:05 -0400 |
| commit | 222ab374d53a206332b1ab51c7c43f6d5dc7a31e (patch) | |
| tree | 2b446d96bfc6c7efab07f3d0fbb84d96ecb1253b /queries/index.js | |
yep
Diffstat (limited to 'queries/index.js')
| -rw-r--r-- | queries/index.js | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/queries/index.js b/queries/index.js new file mode 100644 index 0000000..6471436 --- /dev/null +++ b/queries/index.js @@ -0,0 +1,73 @@ +import { gql } from 'react-apollo' +import { itemDetails } from './fragments'; + +export const CREATE_LINK_MUTATION = gql` + ${itemDetails} + mutation CreateLinkMutation($description: String!, $title: String!, $imageId: ID) { + createItem( + description: $description, + title: $title, + imageId: $imageId + ) { + ...itemDetails + } + } +` + +export const CREATE_ORDER_MUTATION = gql` + mutation CreateOrderMutation($token: String!) { + createOrder(token: $token) { + id, + token, + charge, + amount, + email + } + } +`; + + +export const ALL_ITEMS_QUERY = gql` + # Import the Fragment + ${itemDetails} + query AllLinksQuery { + allItems(orderBy: createdAt_DESC) { + # Use that fragment by it's name (even though it the same as the variable) + ...itemDetails + } + } +` + +export const SINGLE_LINK_QUERY = gql` + ${itemDetails} + query FindItem($id: ID!) { + Item(id: $id) { + ...itemDetails + } + } +`; + +export const DELETE_ITEM_MUTATION = gql` + mutation DelteItem($id: ID!) { + deleteItem(id: $id) { + id, + title, + description + } + } +` + +export const UPDATE_LINK_MUTATION = gql` + ${itemDetails} + mutation UpdateItem($id: ID!, $title: String!, $description: String!, $price: Int!, $fullPrice: Int!) { + updateItem( + id: $id, + description: $description, + title: $title, + price: $price, + fullPrice: $fullPrice + ) { + ...itemDetails + } + } +` |
