Calling store method

This commit is contained in:
Michaela Brydon 2024-07-01 11:50:26 -04:00
parent 66be672e6f
commit 7f820f0080
2 changed files with 6 additions and 12 deletions

View file

@ -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);

View file

@ -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';