detail page port
This commit is contained in:
83
libs/shopify/customer.js
Normal file
83
libs/shopify/customer.js
Normal file
@@ -0,0 +1,83 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
}
|
||||
`
|
||||
Reference in New Issue
Block a user