Skip to content

Commit

Permalink
rollback middleware
Browse files Browse the repository at this point in the history
  • Loading branch information
Guysnacho committed Jun 1, 2024
1 parent 4a0d792 commit 1a58865
Showing 1 changed file with 0 additions and 16 deletions.
16 changes: 0 additions & 16 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ async function getCountryCode(
export async function middleware(request: NextRequest) {
const searchParams = request.nextUrl.searchParams
const isOnboarding = searchParams.get("onboarding") === "true"
const isStaticAsset =
request.url.includes("assets") || request.url.includes("favicon.ico")
const cartId = searchParams.get("cart_id")
const checkoutStep = searchParams.get("step")
const onboardingCookie = request.cookies.get("_medusa_onboarding")
Expand All @@ -100,20 +98,6 @@ export async function middleware(request: NextRequest) {
const urlHasCountryCode =
countryCode && request.nextUrl.pathname.split("/")[1].includes(countryCode)

// is static asset
if (isStaticAsset) {
const originalParams = await request.json()
// const transformParams = new URLSearchParams()
// if (originalParams.url.includes("quality"))
// transformParams.append("quality", transformParams.get("q")!)
// if (originalParams.url.includes("width"))
// transformParams.append("width", transformParams.get("w")!)

console.debug(originalParams.toString())
// console.debug(transformParams.toString())
return NextResponse.redirect(new URL(originalParams.url), 304)
}

// check if one of the country codes is in the url
if (
urlHasCountryCode &&
Expand Down

0 comments on commit 1a58865

Please sign in to comment.