mirror of
https://github.com/vercel/commerce.git
synced 2025-07-03 19:51:22 +00:00
17 lines
444 B
TypeScript
17 lines
444 B
TypeScript
import Cookies from 'js-cookie'
|
|
|
|
import { SHOPIFY_CART_URL_COOKIE, SHOPIFY_COOKIE_EXPIRE } from '../const'
|
|
|
|
export const setCheckoutUrlCookie = (checkoutUrl: string) => {
|
|
if (checkoutUrl) {
|
|
const oldCookie = Cookies.get(SHOPIFY_CART_URL_COOKIE)
|
|
if (oldCookie !== checkoutUrl) {
|
|
Cookies.set(SHOPIFY_CART_URL_COOKIE, checkoutUrl, {
|
|
expires: SHOPIFY_COOKIE_EXPIRE,
|
|
})
|
|
}
|
|
}
|
|
}
|
|
|
|
export default setCheckoutUrlCookie
|