Skip to content

Commit

Permalink
Merge pull request #338 from medusajs/chore/v2-cleanups-and-fixes
Browse files Browse the repository at this point in the history
Fixes to storefront to always pass region id, cleanup
  • Loading branch information
olivermrbl authored Jul 2, 2024
2 parents 179a245 + f6acc35 commit 5abd88d
Show file tree
Hide file tree
Showing 26 changed files with 213 additions and 246 deletions.
1 change: 1 addition & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ NEXT_PUBLIC_STRIPE_KEY=
NEXT_PUBLIC_PAYPAL_CLIENT_ID=

# Your MeiliSearch / Algolia keys. See – https://docs.medusajs.com/add-plugins/meilisearch or https://docs.medusajs.com/add-plugins/algolia
NEXT_PUBLIC_FEATURE_SEARCH_ENABLED=false
NEXT_PUBLIC_SEARCH_APP_ID=
NEXT_PUBLIC_SEARCH_ENDPOINT=http://127.0.0.1:7700
NEXT_PUBLIC_SEARCH_API_KEY=
Expand Down
2 changes: 0 additions & 2 deletions netlify.toml

This file was deleted.

8 changes: 2 additions & 6 deletions next.config.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
const { withStoreConfig } = require("./store-config")
const store = require("./store.config.json")

/**
* @type {import('next').NextConfig}
*/
const nextConfig = withStoreConfig({
features: store.features,
const nextConfig = {
reactStrictMode: true,
images: {
remotePatterns: [
Expand All @@ -27,7 +23,7 @@ const nextConfig = withStoreConfig({
},
],
},
})
}

console.log("next.config.js", JSON.stringify(module.exports, null, 2))

Expand Down
13 changes: 4 additions & 9 deletions src/app/[countryCode]/(checkout)/checkout/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import CheckoutForm from "@modules/checkout/templates/checkout-form"
import CheckoutSummary from "@modules/checkout/templates/checkout-summary"
import { enrichLineItems, retrieveCart } from "@lib/data/cart"
import { HttpTypes } from "@medusajs/types"
import { getCustomer } from "@lib/data/customer"

export const metadata: Metadata = {
title: "Checkout",
Expand All @@ -18,10 +19,7 @@ const fetchCart = async () => {
}

if (cart?.items?.length) {
const enrichedItems = await enrichLineItems(
cart?.items,
cart?.currency_code
)
const enrichedItems = await enrichLineItems(cart?.items, cart?.region_id!)
cart.items = enrichedItems as HttpTypes.StoreCartLineItem[]
}

Expand All @@ -30,15 +28,12 @@ const fetchCart = async () => {

export default async function Checkout() {
const cart = await fetchCart()

if (!cart) {
return notFound()
}
const customer = await getCustomer()

return (
<div className="grid grid-cols-1 small:grid-cols-[1fr_416px] content-container gap-x-40 py-12">
<Wrapper cart={cart}>
<CheckoutForm />
<CheckoutForm cart={cart} customer={customer} />
</Wrapper>
<CheckoutSummary cart={cart} />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function getOrder(id: string) {
return
}

const enrichedItems = await enrichLineItems(order.items, order.currency_code)
const enrichedItems = await enrichLineItems(order.items, order.region_id!)

return {
...order,
Expand Down
5 changes: 1 addition & 4 deletions src/app/[countryCode]/(main)/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,7 @@ const fetchCart = async () => {
}

if (cart?.items?.length) {
const enrichedItems = await enrichLineItems(
cart?.items,
cart?.currency_code
)
const enrichedItems = await enrichLineItems(cart?.items, cart?.region_id!)
cart.items = enrichedItems as HttpTypes.StoreCartLineItem[]
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/[countryCode]/(main)/order/confirmed/[id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function getOrder(id: string) {
return
}

const enrichedItems = await enrichLineItems(order.items, order.currency_code)
const enrichedItems = await enrichLineItems(order.items, order.region_id!)

return {
...order,
Expand Down
Loading

0 comments on commit 5abd88d

Please sign in to comment.