Skip to content

Commit

Permalink
fix: temp
Browse files Browse the repository at this point in the history
  • Loading branch information
maxakuru committed Sep 11, 2024
1 parent 20dc987 commit 4bd2364
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}
Expand All @@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 4bd2364

Please sign in to comment.