From 4bd23648792a9e6a284028255031266e95b133b6 Mon Sep 17 00:00:00 2001 From: Max Edell Date: Tue, 10 Sep 2024 17:23:59 -0700 Subject: [PATCH] fix: temp --- src/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/index.js b/src/index.js index d24606b..61e7cc8 100644 --- a/src/index.js +++ b/src/index.js @@ -125,8 +125,9 @@ function resolvePDPTemplate(product) { * @param {Context} ctx */ async function handlePDPRequest(ctx) { + // TODO: pull from config // eslint-disable-next-line no-unused-vars - const [_, tenant, _route, _pageType, sku] = ctx.url.pathname.split('/'); + const [_, tenant, _route, _geo, _pageType, urlKey, sku] = ctx.url.pathname.split('/'); if (!sku) { return errorResponse(404, 'missing sku'); } @@ -138,7 +139,7 @@ async function handlePDPRequest(ctx) { } // const product = await fetchProductCore({ sku }, config); - const product = await fetchProductCS(sku, config); + const product = await fetchProductCS(sku.toUpperCase(), config); const html = resolvePDPTemplate(product); return new Response(html, { status: 200, @@ -152,7 +153,7 @@ async function handlePDPRequest(ctx) { * @param {Context} ctx */ async function handleContentRequest(ctx) { - const [pageType] = ctx.url.pathname.split('/').slice(3); + const [pageType] = ctx.url.pathname.split('/').slice(4); switch (pageType) { case 'product': return handlePDPRequest(ctx);