bailout when getPartsOrQuestions errors
This commit is contained in:
parent
d7deb7dc72
commit
aa992395d0
4 changed files with 22 additions and 10 deletions
|
|
@ -8,7 +8,8 @@ const bailoutCode = Object.freeze({
|
|||
PricingResponseError: 6,
|
||||
TPANotEnabled: 7,
|
||||
RequestCallback: 8,
|
||||
HeavyTruckVehicle: 9
|
||||
HeavyTruckVehicle: 9,
|
||||
NoPartsAvailable: 10
|
||||
});
|
||||
|
||||
export default bailoutCode;
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ const bailoutMessage = Object.freeze({
|
|||
HeavyTruckVehicle: (carId) => ({
|
||||
code: bailoutCode.HeavyTruckVehicle,
|
||||
message: `User selected a heavy truck vehicle. Car ID: ${carId} `
|
||||
}),
|
||||
NoPartsAvailable: (error) => ({
|
||||
code: bailoutCode.NoPartsAvailable,
|
||||
message: `An error occurred in getPartsOrQuestions. Error: ${getItemData(error)}`
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
|||
|
|
@ -274,21 +274,27 @@ export default {
|
|||
return null;
|
||||
}
|
||||
|
||||
let hasBailedOut = false;
|
||||
const partsOrQuestionsResponse = await this.getPartsOrQuestions();
|
||||
if (partsOrQuestionsResponse.error) {
|
||||
// To Do: Need requirement on what to do here
|
||||
this.mainStore.setBailout(
|
||||
bailoutMessage.NoPartsAvailable(partsOrQuestionsResponse.error.data));
|
||||
window.console.error('Error on retrieving PartsOrQuestions');
|
||||
this.$refs.siteFooter.removeLoader();
|
||||
return null;
|
||||
hasBailedOut = true;
|
||||
this.$router.navigate(
|
||||
this.navigationScenarios.CLICKED_FORWARD_WITH_BAILOUT,
|
||||
this.$route
|
||||
);
|
||||
}
|
||||
|
||||
// Comes from vehicleQuestionsMixin.navigateForward()
|
||||
await this.navigateForward(
|
||||
partsOrQuestionsResponse.data.partsOrQuestions,
|
||||
this
|
||||
);
|
||||
|
||||
return null;
|
||||
if (!hasBailedOut) {
|
||||
await this.navigateForward(
|
||||
partsOrQuestionsResponse.data.partsOrQuestions,
|
||||
this
|
||||
);
|
||||
}
|
||||
},
|
||||
async lookupVehicleByVin(vin) {
|
||||
try {
|
||||
|
|
|
|||
|
|
@ -347,7 +347,8 @@ export default {
|
|||
} catch (responseError) {
|
||||
return {
|
||||
error: {
|
||||
status: responseError.status
|
||||
status: responseError.status,
|
||||
data: responseError.data
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue