rename checkoutCreate to createCart and remove Shopify checkout API

Signed-off-by: Loan Laux <loan@outgrow.io>
This commit is contained in:
Loan Laux
2021-04-27 18:47:39 +04:00
parent f52978e1a3
commit 3496b2a155
7 changed files with 11 additions and 64 deletions

View File

@@ -3,13 +3,12 @@ import {
SHOPIFY_CHECKOUT_URL_COOKIE,
REACTION_COOKIE_EXPIRE,
} from '../../const'
import checkoutCreateMutation from '../../utils/mutations/checkout-create'
import createCartMutation from '../../utils/mutations/create-cart'
import Cookies from 'js-cookie'
export const checkoutCreate = async (fetch: any) => {
export const createCart = async (fetch: any) => {
const data = await fetch({
query: checkoutCreateMutation,
query: createCartMutation,
variables: {
input: {
shopId,
@@ -25,10 +24,9 @@ export const checkoutCreate = async (fetch: any) => {
expires: REACTION_COOKIE_EXPIRE,
}
Cookies.set(REACTION_ANONYMOUS_CART_TOKEN_COOKIE, checkoutId, options)
Cookies.set(SHOPIFY_CHECKOUT_URL_COOKIE, checkout?.webUrl, options)
}
return checkout
}
export default checkoutCreate
export default createCart

View File

@@ -1,2 +1,2 @@
export { default as checkoutToCart } from './checkout-to-cart'
export { default as checkoutCreate } from './checkout-create'
export { default as checkoutCreate } from './create-cart'