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

@@ -6,7 +6,7 @@ import useCommerceCart, {
import { Cart } from '../types'
import { SWRHook } from '@commerce/utils/types'
import { checkoutCreate, checkoutToCart } from '../utils'
import { checkoutCreate, checkoutToCart, getCheckoutId } from '../utils'
import getCheckoutQuery from '../utils/queries/get-checkout-query'
export default useCommerceCart as UseCart<typeof handler>
@@ -27,7 +27,7 @@ export const handler: SWRHook<
const data = await fetch({
...options,
variables: {
checkoutId: checkoutId,
checkoutId: getCheckoutId().checkoutToken,
},
})
checkout = data.node