From e882ffa5c5abacc95bee899a30b4707186af08e6 Mon Sep 17 00:00:00 2001 From: Konstantin Fandelyuk Date: Fri, 6 Dec 2024 17:51:28 +0200 Subject: [PATCH] test 6 --- .../commerce-create-return/commerce-create-return.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/blocks/commerce-create-return/commerce-create-return.js b/blocks/commerce-create-return/commerce-create-return.js index 5f1e325b2b..5adcda1c09 100644 --- a/blocks/commerce-create-return/commerce-create-return.js +++ b/blocks/commerce-create-return/commerce-create-return.js @@ -10,6 +10,12 @@ import '../../scripts/initializers/order.js'; export default async function decorate(block) { await orderRenderer.render(CreateReturn, { - routeReturnSuccess: (orderData) => (checkIsAuthenticated() ? `${CUSTOMER_ORDER_DETAILS_PATH}?orderRef=${orderData.number}` : `${ORDER_DETAILS_PATH}?orderRef=${orderData.token}`), + routeReturnSuccess: (orderData) => { + const orderRef = checkIsAuthenticated() ? orderData.number : orderData.token; + const encodedOrderRef = encodeURIComponent(orderRef); + const path = checkIsAuthenticated() ? CUSTOMER_ORDER_DETAILS_PATH : ORDER_DETAILS_PATH; + + return `${path}?orderRef=${encodedOrderRef}`; + }, })(block); -} +} \ No newline at end of file