commerce/lib/bigcommerce/cart/use-open-checkout.tsx
2020-10-12 20:03:53 -05:00

12 lines
261 B
TypeScript

import useCart from './use-cart'
export default function useOpenCheckout() {
const { data, mutate } = useCart()
return async function openCheckout() {
window.open(data?.redirect_urls.checkout_url)
// Get new redirect urls
await mutate()
}
}