84 lines
2.2 KiB
JavaScript
84 lines
2.2 KiB
JavaScript
import { gql } from 'graphql-request'
|
|
import { IMAGE_FRAGMENT, PRICE_FRAGMENT } from './fragments'
|
|
|
|
export const GET_CUSTOMER = gql`
|
|
${IMAGE_FRAGMENT}
|
|
${PRICE_FRAGMENT}
|
|
|
|
query getCustomer {
|
|
customer {
|
|
id
|
|
defaultAddress {
|
|
address1
|
|
address2
|
|
city
|
|
zoneCode
|
|
zip
|
|
country
|
|
}
|
|
firstName
|
|
lastName
|
|
emailAddress {
|
|
emailAddress
|
|
}
|
|
orders(first: 100) {
|
|
edges {
|
|
node {
|
|
id
|
|
name
|
|
number
|
|
createdAt
|
|
statusPageUrl
|
|
totalPrice {
|
|
amount
|
|
currencyCode
|
|
}
|
|
lineItems(first: 100) {
|
|
edges {
|
|
node {
|
|
id
|
|
name
|
|
image {
|
|
...ImageFields
|
|
}
|
|
price {
|
|
...PriceFields
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`
|
|
|
|
export const UPDATE_CUSTOMER = gql`
|
|
mutation updateCustomerAndAddress(
|
|
$address: CustomerAddressInput!
|
|
$input: CustomerUpdateInput!
|
|
) {
|
|
customerAddressCreate(address: $address, defaultAddress: true) {
|
|
customerAddress {
|
|
address1
|
|
address2
|
|
city
|
|
province
|
|
country
|
|
}
|
|
userErrors {
|
|
code
|
|
field
|
|
message
|
|
}
|
|
}
|
|
customerUpdate(input: $input) {
|
|
customer {
|
|
firstName
|
|
lastName
|
|
}
|
|
}
|
|
}
|
|
`
|