From 1cab64f8abc9d946e28ada75dbb92d233f5cc630 Mon Sep 17 00:00:00 2001 From: CarlNation <32103961+CarlNation@users.noreply.github.com> Date: Fri, 16 Feb 2024 14:26:05 -0500 Subject: [PATCH] CSR-1072 CSR-1072 insurance orders will remove line items depending on the company. mobile fee, recycle fee, etc. So we can return from heritage with nothing in supporting items. So only add lineItems when they exist on the serviceability call --- src/store/index.js | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/src/store/index.js b/src/store/index.js index 70ee5a8b3..e53dc4482 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -1374,15 +1374,19 @@ export const actions = { }, getServiceabilityDetails(context, { payload: { serviceZipCode }, pageNameToLog }) { - const lineItemsWithOnlyPartNumbers = context.getters.order.lineItems.supportingItems.map( + const lineItemsWithOnlyPartNumbers = context.getters.order.lineItems.supportingItems?.map( (lineItem) => ({ partNumber: lineItem.partNumber, }) ); - const lineItems = buildQueryStringParameterFromArrayOfComplexObjects( - lineItemsWithOnlyPartNumbers, - "lineItems" - ); + + var lineItems = null; + if (lineItemsWithOnlyPartNumbers) { + lineItems = buildQueryStringParameterFromArrayOfComplexObjects( + lineItemsWithOnlyPartNumbers, + "lineItems" + ); + } const vehicle = context.getters.vehicle; const carId = vehicle.carId; @@ -1394,9 +1398,20 @@ export const actions = { "glassPieces" ); + var endPoint = `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&carId=${carId}`; + if (lineItems) { + endPoint += `&${lineItems}`; + } + + if (glassPieces) { + endPoint += `&${glassPieces}`; + } + + console.log("EP:" + endPoint); + return globalMethods.callHttpClient({ method: endpoints.GetServiceabilityDetails.method, - endpoint: `${endpoints.GetServiceabilityDetails.url}?zip=${serviceZipCode}&carId=${carId}&${lineItems}&${glassPieces}`, + endpoint: endPoint, logApiCall: true, pageNameToLog: pageNameToLog, });