return empty if call returns 500
This commit is contained in:
parent
36fbca4ba0
commit
f2b9df02de
2 changed files with 21 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ export default {
|
||||||
if (this.mainStore.order.vehicle.vinRequired) {
|
if (this.mainStore.order.vehicle.vinRequired) {
|
||||||
result = await useMainStore().getPartsOrQuestionsV2();
|
result = await useMainStore().getPartsOrQuestionsV2();
|
||||||
if (result.data.partsOrQuestions.length === 0) {
|
if (result.data.partsOrQuestions.length === 0) {
|
||||||
|
useMainStore().resetBailout();
|
||||||
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -26,6 +27,7 @@ export default {
|
||||||
|
|
||||||
this.mainStore.order.vehicle.vin = vin;
|
this.mainStore.order.vehicle.vin = vin;
|
||||||
if (hasYMMExperimentBailoutSettingEnabled()) {
|
if (hasYMMExperimentBailoutSettingEnabled()) {
|
||||||
|
useMainStore().resetBailout();
|
||||||
this.navigateBailout(bailoutMessage.YMMNotFound());
|
this.navigateBailout(bailoutMessage.YMMNotFound());
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
@ -33,6 +35,7 @@ export default {
|
||||||
if (hasYMMExperimentPageSettingEnabled()) {
|
if (hasYMMExperimentPageSettingEnabled()) {
|
||||||
const partsOrQuestionsResponse = await useMainStore().getPartsOrQuestionsV2();
|
const partsOrQuestionsResponse = await useMainStore().getPartsOrQuestionsV2();
|
||||||
if (partsOrQuestionsResponse.data.partsOrQuestions.length === 0) {
|
if (partsOrQuestionsResponse.data.partsOrQuestions.length === 0) {
|
||||||
|
useMainStore().resetBailout();
|
||||||
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
this.navigateBailout(bailoutMessage.YMMNotFound('No Parts Returned'));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -891,11 +891,18 @@ export const useMainStore = defineStore({
|
||||||
method: endpoints.GetPartsOrQuestionsV2.method,
|
method: endpoints.GetPartsOrQuestionsV2.method,
|
||||||
endpoint: endpoints.GetPartsOrQuestionsV2.url,
|
endpoint: endpoints.GetPartsOrQuestionsV2.url,
|
||||||
payload: payload
|
payload: payload
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
partsOrQuestions: []
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
// Flatten location and name properties
|
// Flatten location and name properties
|
||||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions);
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions);
|
||||||
|
|
||||||
// If no parts are returned for non oem check for OEM parts
|
// If no parts are returned for non oem check for OEM parts
|
||||||
if (!payload.oemEndorsementFlag && response.data.partsOrQuestions.length === 0) {
|
if (!payload.oemEndorsementFlag && response.data.partsOrQuestions.length === 0) {
|
||||||
payload.oemEndorsementFlag = true;
|
payload.oemEndorsementFlag = true;
|
||||||
|
|
@ -903,10 +910,18 @@ export const useMainStore = defineStore({
|
||||||
method: endpoints.GetPartsOrQuestionsV2.method,
|
method: endpoints.GetPartsOrQuestionsV2.method,
|
||||||
endpoint: endpoints.GetPartsOrQuestionsV2.url,
|
endpoint: endpoints.GetPartsOrQuestionsV2.url,
|
||||||
payload: payload
|
payload: payload
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return {
|
||||||
|
data: {
|
||||||
|
partsOrQuestions: []
|
||||||
|
}
|
||||||
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions);
|
response.data.partsOrQuestions = convertGlassPieceNamingFromApi(response.data.partsOrQuestions);
|
||||||
}
|
}
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
async getParts() {
|
async getParts() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue