Merge pull request #1518 from Safelite/feature/skiener/CSR-1452

CSR-1452 | Loading modal spinner for revalidate (payment-method)
This commit is contained in:
scottkiener 2023-11-13 14:50:13 -05:00 committed by GitHub
commit 3fec7ad060
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View file

@ -54,6 +54,14 @@
</template>
<script>
const windowPageShowCallback = function (evt) {
if (evt.persisted) {
setTimeout(function () {
window.location.reload();
}, 10);
}
};
export default {
name: "Modal",
data() {
@ -93,17 +101,11 @@ export default {
this.isModalTextCarouselVisible = showTextCarousel;
this.isModalVisible = true;
//Force page reload on back button
window.addEventListener(
"pageshow",
function (evt) {
if (evt.persisted) {
setTimeout(function () {
window.location.reload();
}, 10);
}
},
false
);
window.addEventListener("pageshow", windowPageShowCallback, false);
},
hideModal() {
this.isModalVisible = false;
window.removeEventListener("pageshow", windowPageShowCallback, false);
},
},
};

View file

@ -323,6 +323,7 @@ export default {
return this.$store.getters.order.payment.inactivePromos;
},
async revalidatePromos() {
this.$refs.loadingModal.showModal();
const revalidatePromoResponse = await baseMixin.methods.dispatchStoreActionWithLogging(
storeActions.REVALIDATE_ORDER_PROMOS_AND_SAVE_SERVER_DATA,
{
@ -344,6 +345,7 @@ export default {
this.lineItems.promos = revalidatePromoResponse.promoLineItems;
this.inactivePromos = revalidatePromoResponse.errors.map((x) => x.promoCode);
this.$refs.loadingModal.hideModal();
},
backButtonAction() {
this.$router.navigateWithoutSaving(this.navigationScenarios.CLICKED_BACK, this.$route);