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 // set recalibration properties of parts based on capability question answers
for (let answer of questionAnswersArray) { for (let answer of questionAnswersArray) {
const partAssociatedWithAnswer = this.partsOrQuestionsData.find((x) => x.glassLocation === answer.glassLocation).parts[0]; let partAssociatedWithAnswer = this.partsOrQuestionsData.find((x) => x.glassLocation === answer.glassLocation).parts[0];
setPartRecalibrationProperties(partAssociatedWithAnswer, answer); partAssociatedWithAnswer = await useMainStore().getPartFromCapabilityQuestionAnswer(partAssociatedWithAnswer, answer);
console.log(JSON.stringify(partAssociatedWithAnswer));
} }
this.navigateForward(this.partsOrQuestionsData, null); this.navigateForward(this.partsOrQuestionsData, null);

View file

@ -815,22 +815,15 @@ export const useMainStore = defineStore({
}); });
}, },
getPartFromCapabilityQuestionAnswer(glassLocation) { async getPartFromCapabilityQuestionAnswer(part, capabilityQuestionAnswersForPart) {
const pageData = this.pageData(issPageValues.CAPABILITY_QUESTIONS); return (await globalMethods.callHttpClient({
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({
method: endpoints.GetPartFromCapabilityAnswer.method, method: endpoints.GetPartFromCapabilityAnswer.method,
endpoint: endpoints.GetPartFromCapabilityAnswer.url, endpoint: endpoints.GetPartFromCapabilityAnswer.url,
payload: { payload: {
part, part,
capabilityAnswerResults: capabilityQuestionAnswersForPart capabilityAnswerResults: capabilityQuestionAnswersForPart
} }
}); })).data[0];
}, },
getMobilePremiumFee() { getMobilePremiumFee() {
const damageType = this.damage.isRepair ? 'Repair' : 'Replace'; const damageType = this.damage.isRepair ? 'Repair' : 'Replace';