From 1f53b29a69c5fd676eb56f6fbfa16fb6104780e7 Mon Sep 17 00:00:00 2001 From: Hrishikesh Vaipurkar Date: Tue, 2 Jul 2024 15:50:46 +0200 Subject: [PATCH] feat: WEB-210 Updated .map to avoid mutation --- server/routers/user/query.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/server/routers/user/query.ts b/server/routers/user/query.ts index 13323917a..dbd6cf9b8 100644 --- a/server/routers/user/query.ts +++ b/server/routers/user/query.ts @@ -110,14 +110,19 @@ const updateStaysBookingUrl = async ( if (apiResponse.ok) { const apiJson = await apiResponse.json() if (apiJson.data?.attributes) { - data.map((stay: Stay) => { + return data.map((stay: Stay) => { const originalString = stay.attributes.confirmationNumber.toString() + "," + apiJson.data.attributes.lastName let encryptedBookingValue = encryptValue(originalString) - stay.attributes.bookingUrl = - fullBookingUrl + "?RefId=" + encryptedBookingValue + return { + ...stay, + attributes: { + ...stay.attributes, + bookingUrl: fullBookingUrl + "?RefId=" + encryptedBookingValue, + }, + } }) } }