mirror of
https://github.com/vercel/commerce.git
synced 2025-07-22 20:26:49 +00:00
✨ feat: test checkout
:%s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import React, { useState } from 'react'
|
||||
import { Logo } from 'src/components/common'
|
||||
import { ButtonCommon, Logo } from 'src/components/common'
|
||||
import CheckoutCollapse from 'src/components/common/CheckoutCollapse/CheckoutCollapse'
|
||||
import { useAddProductToCart, useGetActiveOrder } from 'src/components/hooks/cart'
|
||||
import { removeItem } from 'src/utils/funtion.utils'
|
||||
import { CheckOutForm } from 'src/utils/types.utils'
|
||||
import s from './CheckoutInfo.module.scss'
|
||||
@@ -67,8 +68,25 @@ const CheckoutInfo = ({onViewCart}: CheckoutInfoProps) => {
|
||||
form: <PaymentInfoForm onConfirm={onConfirm} id={3} />,
|
||||
},
|
||||
]
|
||||
|
||||
// TODO: remove
|
||||
const { addProduct } = useAddProductToCart()
|
||||
|
||||
const createOrder = () => {
|
||||
addProduct({ variantId: "63", quantity: 1 }, handleAddToCartCallback)
|
||||
}
|
||||
const handleAddToCartCallback = (isSuccess: boolean, message?: string) => {
|
||||
console.log("after create order: ", isSuccess, message)
|
||||
|
||||
}
|
||||
|
||||
const {order} = useGetActiveOrder()
|
||||
console.log("active order: ", order)
|
||||
|
||||
return (
|
||||
<div className={s.warpper}>
|
||||
<ButtonCommon onClick={createOrder}>test create order</ButtonCommon>
|
||||
<ButtonCommon onClick={createOrder}>test get active order</ButtonCommon>
|
||||
<div className={s.title}>
|
||||
<Logo />
|
||||
<div className={s.viewCart} onClick={onViewCart}>View cart</div>
|
||||
|
Reference in New Issue
Block a user