From 8a0d622049c323c0105ea6be543a77022bd2ee67 Mon Sep 17 00:00:00 2001 From: CarlNation Date: Mon, 3 Feb 2025 15:07:38 -0500 Subject: [PATCH] CASH-48 CASH-48 null check --- src/layouts/confirmation/confirmation.vue | 54 +++++++++++------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/src/layouts/confirmation/confirmation.vue b/src/layouts/confirmation/confirmation.vue index f699d6a59..d495d8217 100644 --- a/src/layouts/confirmation/confirmation.vue +++ b/src/layouts/confirmation/confirmation.vue @@ -120,35 +120,35 @@ export default { const partsOrQuestions = orderFromStore.damage?.partQuestionAnswers; - partsOrQuestions.forEach(pqa => { - const payloadPartQuestions = []; - pqa.answeredQuestions.forEach(answer => { - payloadPartQuestions.push({ - questionSeq: answer?.questionNum, - questionText: answer?.questionText, - answerText: answer?.selectedAnswerText, - basePart: pqa?.result, + if (partsOrQuestions) { + partsOrQuestions.forEach(pqa => { + const payloadPartQuestions = []; + pqa.answeredQuestions.forEach(answer => { + payloadPartQuestions.push({ + questionSeq: answer?.questionNum, + questionText: answer?.questionText, + answerText: answer?.selectedAnswerText, + basePart: pqa?.result, + }); }); + + const payload = { + eon: orderFromStore.eon, + ctu: ctu, + workOrderId: orderFromStore.workOrderId, + workOrderNumber: orderFromStore.workOrderNumber, + carId: orderFromStore.vehicle.carId, + glassLocation: pqa?.glassLocation, + partQuestions: payloadPartQuestions, + }; + + baseMixin.methods.dispatchStoreAction( + storeActions.LOG_PART_QUESTIONS, + payload, + false + ); }); - - const payload = { - eon: orderFromStore.eon, - ctu: ctu, - workOrderId: orderFromStore.workOrderId, - workOrderNumber: orderFromStore.workOrderNumber, - carId: orderFromStore.vehicle.carId, - glassLocation: pqa?.glassLocation, - partQuestions: payloadPartQuestions, - }; - - baseMixin.methods.dispatchStoreAction( - storeActions.LOG_PART_QUESTIONS, - payload, - false - ); - - }); - + } // Create order await baseMixin.methods.dispatchStoreAction(storeActions.CREATE_SUBMITTED_ORDER); // This nulls the Store order