Skip to content

Commit 9c90057

Browse files
committed
make CheckoutSummary client component
1 parent 17bc208 commit 9c90057

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/app/[countryCode]/(checkout)/checkout/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ export default async function Checkout() {
4747
<Wrapper cart={cart}>
4848
<CheckoutForm />
4949
</Wrapper>
50-
<CheckoutSummary />
50+
<CheckoutSummary cart={cart} />
5151
</div>
5252
)
5353
}

src/modules/checkout/templates/checkout-form/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
"use server"
2+
13
import {
24
createPaymentSessions,
35
getCustomer,

src/modules/checkout/templates/checkout-summary/index.tsx

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,21 @@
1+
"use client"
2+
13
import { Heading } from "@medusajs/ui"
24

3-
import { getScopedI18n } from "../../../../locales/server"
5+
import { useScopedI18n } from "../../../../locales/client"
46

57
import ItemsPreviewTemplate from "@modules/cart/templates/preview"
68
import DiscountCode from "@modules/checkout/components/discount-code"
79
import CartTotals from "@modules/common/components/cart-totals"
810
import Divider from "@modules/common/components/divider"
9-
import { cookies } from "next/headers"
10-
import { getCart } from "@lib/data"
11-
12-
const CheckoutSummary = async () => {
13-
const t = await getScopedI18n("checkout")
14-
const cartId = cookies().get("_medusa_cart_id")?.value
11+
import { Cart } from "medusa-react"
1512

16-
if (!cartId) {
17-
return null
18-
}
13+
type CheckoutSummaryProps = {
14+
cart: Omit<Cart, "refundable_amount" | "refunded_total">
15+
}
1916

20-
const cart = await getCart(cartId).then((cart) => cart)
17+
const CheckoutSummary: React.FC<CheckoutSummaryProps> = ({ cart }) => {
18+
const t = useScopedI18n("checkout")
2119

2220
if (!cart) {
2321
return null

0 commit comments

Comments
 (0)