Refactor promises to awaits

This commit is contained in:
Chloe Herd 2025-07-22 15:51:05 -04:00
parent dfbdee4f90
commit 64e91ca4f3

View file

@ -1185,34 +1185,27 @@ export default {
(this.isServiceableInshop && !selectedDateInshop) || (this.isServiceableInshop && !selectedDateInshop) ||
(this.isServiceableDropoff && !selectedDateInshop) (this.isServiceableDropoff && !selectedDateInshop)
) { ) {
this.$nextTick(() => { await this.$nextTick();
this.$refs.datePicker.showAnotherMonth().then((moreSelectableDates) => { await this.$refs.datePicker.showAnotherMonth();
// update all dates
// > CHLOE HERD 7/22 -- CASH-1207 // update all dates
// > Do not update the available dates again here;
// > they have already been updated by `showAnotherMonth`.
// > Doing so will likely add or remove dates,
// > desyncing the schedule page and the date-picker.
if (!selectedDateInshop) { // > CHLOE HERD 7/22 -- CASH-1207
selectedDateInshop = this.getSelectedDateForInshop(); // > Do not update the available dates again here;
} // > they have already been updated by `showAnotherMonth`.
if (!selectedDateMobile) { // > Doing so will likely add or remove dates,
selectedDateMobile = this.getSelectedDateForMobile(); // > desyncing the schedule page and the date-picker.
}
this.setDisplayWaitList(); this.setDisplayWaitList();
}); }
});
await this.$nextTick();
if (this.isMobileSelected) {
this.selectedDate = this.getSelectedDateForMobile();
} else {
this.selectedDate = this.getSelectedDateForInshop();
} }
this.$nextTick(() => {
if (this.isMobileSelected) {
this.selectedDate = selectedDateMobile;
} else {
this.selectedDate = selectedDateInshop;
}
});
} }
}, },
getScheduleApiResponse, getScheduleApiResponse,