From f2b9df02deb1e8d524b3d9c5ffa665f294e432d9 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Thu, 23 Jul 2026 15:56:47 -0400 Subject: [PATCH] return empty if call returns 500 --- src/mixins/vin-pages-mixin.js | 3 +++ src/store/index.js | 21 ++++++++++++++++++--- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/src/mixins/vin-pages-mixin.js b/src/mixins/vin-pages-mixin.js index 83ae4cea..89997eae 100644 --- a/src/mixins/vin-pages-mixin.js +++ b/src/mixins/vin-pages-mixin.js @@ -10,6 +10,7 @@ export default { if (this.mainStore.order.vehicle.vinRequired) { result = await useMainStore().getPartsOrQuestionsV2(); if (result.data.partsOrQuestions.length === 0) { + useMainStore().resetBailout(); this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned')); return; } @@ -26,6 +27,7 @@ export default { this.mainStore.order.vehicle.vin = vin; if (hasYMMExperimentBailoutSettingEnabled()) { + useMainStore().resetBailout(); this.navigateBailout(bailoutMessage.YMMNotFound()); return true; } @@ -33,6 +35,7 @@ export default { if (hasYMMExperimentPageSettingEnabled()) { const partsOrQuestionsResponse = await useMainStore().getPartsOrQuestionsV2(); if (partsOrQuestionsResponse.data.partsOrQuestions.length === 0) { + useMainStore().resetBailout(); this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned')); return true; } diff --git a/src/store/index.js b/src/store/index.js index 613b453d..f03d73f3 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -891,11 +891,18 @@ export const useMainStore = defineStore({ method: endpoints.GetPartsOrQuestionsV2.method, endpoint: endpoints.GetPartsOrQuestionsV2.url, payload: payload + }) + .catch(() => { + return { + data: { + partsOrQuestions: [] + } + }; }); - + // Flatten location and name properties response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions); - + // If no parts are returned for non oem check for OEM parts if (!payload.oemEndorsementFlag && response.data.partsOrQuestions.length === 0) { payload.oemEndorsementFlag = true; @@ -903,10 +910,18 @@ export const useMainStore = defineStore({ method: endpoints.GetPartsOrQuestionsV2.method, endpoint: endpoints.GetPartsOrQuestionsV2.url, payload: payload + }) + .catch(() => { + return { + data: { + partsOrQuestions: [] + } + }; }); + response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions); } - + return response; }, async getParts() {