mirror of
https://github.com/vercel/commerce.git
synced 2025-05-23 01:46:58 +00:00
21 lines
460 B
TypeScript
21 lines
460 B
TypeScript
import { getCart } from 'lib/shopify';
|
|
import { cookies } from 'next/headers';
|
|
import { Suspense } from 'react';
|
|
import CartModal from './modal';
|
|
import OpenCart from './open-cart';
|
|
|
|
export default async function Cart() {
|
|
const cartId = cookies().get('cartId')?.value;
|
|
let cart;
|
|
|
|
if (cartId) {
|
|
cart = await getCart(cartId);
|
|
}
|
|
|
|
return (
|
|
<Suspense fallback={<OpenCart className="h-6" />}>
|
|
<CartModal cart={cart} />
|
|
</Suspense>
|
|
);
|
|
}
|