return empty if call returns 500

This commit is contained in:
Bill Richardson 2026-07-23 15:56:47 -04:00
parent 36fbca4ba0
commit f2b9df02de
2 changed files with 21 additions and 3 deletions

View file

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

View file

@ -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() {