diff --git a/src/store/index.js b/src/store/index.js index 911e08f5..334b294d 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -556,7 +556,7 @@ export const useMainStore = defineStore({ const { vin } = vehicle; // create a new array to avoid mutating state - const glassArrayForPayload = convertGlassPieceNamingForApi(glassArray); + const glassArrayForPayload = convertGlassPieceToBackEndCompatibleFormat(glassArray); const response = await globalMethods.callHttpClient({ method: endpoints.GetPartsOrQuestions.method, @@ -655,7 +655,7 @@ export const useMainStore = defineStore({ partType: lineItem.partType })); const glassPieces = order.damage.glassToReplace - ? convertGlassPieceNamingForApi(order.damage.glassToReplace) + ? convertGlassPieceToBackEndCompatibleFormat(order.damage.glassToReplace) : []; const payload = { startDate, @@ -715,7 +715,7 @@ export const useMainStore = defineStore({ partType: lineItem.partType })); const glassPieces = order.damage.glassToReplace - ? convertGlassPieceNamingForApi(order.damage.glassToReplace) + ? convertGlassPieceToBackEndCompatibleFormat(order.damage.glassToReplace) : []; const payload = { providerNumber, @@ -2069,6 +2069,13 @@ function buildQueryStringParameterFromArrayOfComplexObjects(arrayOfObjects, para return queryStringParameter.slice(0, -1); } +function convertGlassPieceToBackEndCompatibleFormat(glassPieces) { + return glassPieces.map((glassPiece) => ({ + location: glassPiece.glassLocation, + name: glassPiece.glassName + })); +} + function providersEqual(providerA, providerB) { return ( providerA.providerNumber === providerB.providerNumber