saleor: initial cart integration

This commit is contained in:
Zaiste
2021-04-26 16:24:50 +02:00
parent ef10084e54
commit 19445747f1
9 changed files with 41 additions and 76 deletions

View File

@@ -2,16 +2,19 @@ import { checkoutDetailsFragment } from '../queries/get-checkout-query'
const checkoutCreateMutation = /* GraphQL */ `
mutation createCheckout {
checkoutCreate(input: {}) {
checkoutUserErrors {
checkoutCreate(input: {
email: "customer@example.com",
lines: [{quantity: 1, variantId: "UHJvZHVjdFZhcmlhbnQ6Mjk3"}],
channel: "default-channel"
}) {
errors {
code
field
message
}
# Breaks GraphQL Codegen
# checkout {
# ${checkoutDetailsFragment}
# }
checkout {
${checkoutDetailsFragment}
}
}
}
`

View File

@@ -1,16 +1,16 @@
import { checkoutDetailsFragment } from '../queries/get-checkout-query'
const checkoutLineItemAddMutation = /* GraphQL */ `
mutation checkoutLineItemAdd($checkoutId: ID!, $lineItems: [CheckoutLineItemInput!]!) {
checkoutLineItemsAdd(checkoutId: $checkoutId, lineItems: $lineItems) {
checkoutUserErrors {
mutation checkoutLineItemAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {
checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {
errors {
code
field
message
}
# checkout {
# ${checkoutDetailsFragment}
# }
checkout {
${checkoutDetailsFragment}
}
}
}
`