mirror of
https://github.com/vercel/commerce.git
synced 2025-07-04 12:11:22 +00:00
19 lines
379 B
TypeScript
19 lines
379 B
TypeScript
import { SHOPIFY_CART_URL_COOKIE } from '../../../const'
|
|
import type { CheckoutEndpoint } from '.'
|
|
|
|
const checkout: CheckoutEndpoint['handlers']['checkout'] = async ({
|
|
req,
|
|
res,
|
|
}) => {
|
|
const { cookies } = req
|
|
const cartUrl = cookies[SHOPIFY_CART_URL_COOKIE]
|
|
|
|
if (cartUrl) {
|
|
res.redirect(cartUrl)
|
|
} else {
|
|
res.redirect('/cart')
|
|
}
|
|
}
|
|
|
|
export default checkout
|