diff --git a/src/layouts/capability-questions/capability-questions.vue b/src/layouts/capability-questions/capability-questions.vue index ea299883..c4c15c91 100644 --- a/src/layouts/capability-questions/capability-questions.vue +++ b/src/layouts/capability-questions/capability-questions.vue @@ -155,8 +155,9 @@ export default { // set recalibration properties of parts based on capability question answers for (let answer of questionAnswersArray) { - const partAssociatedWithAnswer = this.partsOrQuestionsData.find((x) => x.glassLocation === answer.glassLocation).parts[0]; - setPartRecalibrationProperties(partAssociatedWithAnswer, answer); + let partAssociatedWithAnswer = this.partsOrQuestionsData.find((x) => x.glassLocation === answer.glassLocation).parts[0]; + partAssociatedWithAnswer = await useMainStore().getPartFromCapabilityQuestionAnswer(partAssociatedWithAnswer, answer); + console.log(JSON.stringify(partAssociatedWithAnswer)); } this.navigateForward(this.partsOrQuestionsData, null); diff --git a/src/store/index.js b/src/store/index.js index 28dbc3d7..0f527f1c 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -815,22 +815,15 @@ export const useMainStore = defineStore({ }); }, - getPartFromCapabilityQuestionAnswer(glassLocation) { - const pageData = this.pageData(issPageValues.CAPABILITY_QUESTIONS); - - const part = pageData.partsOrQuestions.find((x) => x.glassLocation === glassLocation) - .parts[0]; - const { capabilityQuestionAnswers } = this.order.damage; - const capabilityQuestionAnswersForPart = capabilityQuestionAnswers.find((x) => x.glassLocation === glassLocation); - - return globalMethods.callHttpClient({ + async getPartFromCapabilityQuestionAnswer(part, capabilityQuestionAnswersForPart) { + return (await globalMethods.callHttpClient({ method: endpoints.GetPartFromCapabilityAnswer.method, endpoint: endpoints.GetPartFromCapabilityAnswer.url, payload: { part, capabilityAnswerResults: capabilityQuestionAnswersForPart } - }); + })).data[0]; }, getMobilePremiumFee() { const damageType = this.damage.isRepair ? 'Repair' : 'Replace';