Change where modal open logic happens
prevents flashing the incorrect data
This commit is contained in:
parent
7324053990
commit
c0a93abfbf
1 changed files with 17 additions and 21 deletions
|
|
@ -13,7 +13,6 @@
|
|||
<modal
|
||||
ref="shopQuestionModal"
|
||||
:headerText="modalHeaderText"
|
||||
:onModalOpenedCallback="onModalOpened"
|
||||
:onModalClosedCallback="onModalClosed"
|
||||
:footerButtonText="modalFooterText"
|
||||
:footerButtonDisabled="
|
||||
|
|
@ -164,6 +163,23 @@ export default {
|
|||
},
|
||||
methods: {
|
||||
openModal() {
|
||||
// Reset local state from parent
|
||||
this.localShopProviderData = this.shopProviderDataFromParent;
|
||||
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
|
||||
this.localZipCode = this.zipCodeFromParent;
|
||||
this.answers = [];
|
||||
|
||||
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
|
||||
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent
|
||||
);
|
||||
|
||||
if (selectedProviderNumberFromParentIndex > -1) {
|
||||
this.indexOfLastShopToBeDisplayed = Math.ceil((selectedProviderNumberFromParentIndex + 1) / 3) * 3;
|
||||
} else {
|
||||
this.indexOfLastShopToBeDisplayed = 3;
|
||||
}
|
||||
|
||||
this.updateShopsForZip(this.localZipCode);
|
||||
this.$refs.shopQuestionModal.openModal();
|
||||
},
|
||||
updateShopListWithNextShops(numberToGet = 3) {
|
||||
|
|
@ -221,26 +237,6 @@ export default {
|
|||
|
||||
this.pushEventToGA(this.GaCategories.SERVICE_LOCATION, this.GaActions.MORE_LOCATIONS_CLICKED, joinedShops, true);
|
||||
},
|
||||
onModalOpened() {
|
||||
// Reset local state from parent
|
||||
this.localShopProviderData = this.shopProviderDataFromParent;
|
||||
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
|
||||
this.localZipCode = this.zipCodeFromParent;
|
||||
this.answers = [];
|
||||
|
||||
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
|
||||
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent
|
||||
);
|
||||
|
||||
if (selectedProviderNumberFromParentIndex > -1) {
|
||||
this.indexOfLastShopToBeDisplayed = Math.ceil((selectedProviderNumberFromParentIndex + 1) / 3) * 3;
|
||||
} else {
|
||||
this.indexOfLastShopToBeDisplayed = 3;
|
||||
}
|
||||
|
||||
this.updateShopsForZip(this.localZipCode);
|
||||
|
||||
},
|
||||
closeModal() {
|
||||
this.modal.closeModal();
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue