Merge pull request #1099 from Safelite/feature/richardson/INSR-8529
dont call shop timeslots if no provider
This commit is contained in:
commit
f0fb72fe05
2 changed files with 10 additions and 6 deletions
|
|
@ -171,20 +171,20 @@ const getAvailableDates = async (
|
||||||
await Promise.all(storeActionConfigs.map(async (storeAction) => {
|
await Promise.all(storeActionConfigs.map(async (storeAction) => {
|
||||||
let timeSlotsResponse = null;
|
let timeSlotsResponse = null;
|
||||||
if (storeAction.storeAction === GET_SHOP_TIME_SLOTS) {
|
if (storeAction.storeAction === GET_SHOP_TIME_SLOTS) {
|
||||||
timeSlotsResponse = await useMainStore().getShopTimeSlots(
|
if (storeAction.payload.providerNumber) {
|
||||||
|
timeSlotsResponse = await useMainStore().getShopTimeSlots(
|
||||||
storeAction.payload.startDate,
|
storeAction.payload.startDate,
|
||||||
storeAction.payload.endDate,
|
storeAction.payload.endDate,
|
||||||
storeAction.payload.shopAppointmentType,
|
storeAction.payload.shopAppointmentType,
|
||||||
storeAction.payload.providerNumber
|
storeAction.payload.providerNumber
|
||||||
);
|
);
|
||||||
|
}
|
||||||
} else if (storeAction.payload?.zipCodeOverride) {
|
} else if (storeAction.payload?.zipCodeOverride) {
|
||||||
timeSlotsResponse = await useMainStore().getMobileTimeSlots(
|
timeSlotsResponse = await useMainStore().getMobileTimeSlots(
|
||||||
storeAction.payload.startDate,
|
storeAction.payload.startDate,
|
||||||
storeAction.payload.endDate,
|
storeAction.payload.endDate,
|
||||||
storeAction.payload.zipCodeOverride
|
storeAction.payload.zipCodeOverride
|
||||||
).catch(() => {
|
);
|
||||||
console.warn('Error fetching mobile time slots...');
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!timeSlotsResponse || !timeSlotsResponse.data) {
|
if (!timeSlotsResponse || !timeSlotsResponse.data) {
|
||||||
|
|
@ -204,6 +204,9 @@ const getAvailableDates = async (
|
||||||
// sort days chronologically
|
// sort days chronologically
|
||||||
timeSlotsResponsesData.days.sort(compareDayStrings);
|
timeSlotsResponsesData.days.sort(compareDayStrings);
|
||||||
return timeSlotsResponsesData;
|
return timeSlotsResponsesData;
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
return timeSlotsResponsesData;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -990,7 +990,8 @@ export const useMainStore = defineStore({
|
||||||
return globalMethods.callHttpClient({
|
return globalMethods.callHttpClient({
|
||||||
method: endpoints.GetShopTimeSlots.method,
|
method: endpoints.GetShopTimeSlots.method,
|
||||||
endpoint: endpoints.GetShopTimeSlots.url,
|
endpoint: endpoints.GetShopTimeSlots.url,
|
||||||
payload
|
payload,
|
||||||
|
bailoutOnError: false
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
async getWipers() {
|
async getWipers() {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue