Skip to content

Commit 4bd2364

Browse files
committed
fix: temp
1 parent 20dc987 commit 4bd2364

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/index.js

+4-3
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,9 @@ function resolvePDPTemplate(product) {
125125
* @param {Context} ctx
126126
*/
127127
async function handlePDPRequest(ctx) {
128+
// TODO: pull from config
128129
// eslint-disable-next-line no-unused-vars
129-
const [_, tenant, _route, _pageType, sku] = ctx.url.pathname.split('/');
130+
const [_, tenant, _route, _geo, _pageType, urlKey, sku] = ctx.url.pathname.split('/');
130131
if (!sku) {
131132
return errorResponse(404, 'missing sku');
132133
}
@@ -138,7 +139,7 @@ async function handlePDPRequest(ctx) {
138139
}
139140

140141
// const product = await fetchProductCore({ sku }, config);
141-
const product = await fetchProductCS(sku, config);
142+
const product = await fetchProductCS(sku.toUpperCase(), config);
142143
const html = resolvePDPTemplate(product);
143144
return new Response(html, {
144145
status: 200,
@@ -152,7 +153,7 @@ async function handlePDPRequest(ctx) {
152153
* @param {Context} ctx
153154
*/
154155
async function handleContentRequest(ctx) {
155-
const [pageType] = ctx.url.pathname.split('/').slice(3);
156+
const [pageType] = ctx.url.pathname.split('/').slice(4);
156157
switch (pageType) {
157158
case 'product':
158159
return handlePDPRequest(ctx);

0 commit comments

Comments
 (0)