1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
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,
}
}
`;
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
}
}
`
|