From 3ad44525e2c0d154e9a94de1eb771e25a142f8a3 Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 7 Jun 2024 16:31:51 +0530 Subject: [PATCH 1/2] Fixed: issue of address not updating inside modal after reopening the modal --- src/views/AddressModal.vue | 15 +++++++++------ src/views/Order.vue | 1 + 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/views/AddressModal.vue b/src/views/AddressModal.vue index 5c4ed8e9..8eda8030 100644 --- a/src/views/AddressModal.vue +++ b/src/views/AddressModal.vue @@ -110,18 +110,21 @@ export default defineComponent({ this.close(this.address); }, prepareAddress() { + if(this.shipGroup?.updatedAddress) { + this.address = this.shipGroup.updatedAddress + return; + } this.address.address1 = this.shipGroup.shipTo.postalAddress.address1 this.address.city = this.shipGroup.shipTo.postalAddress.city this.address.postalCode = this.shipGroup.shipTo.postalAddress.postalCode this.address.stateProvinceGeoId = this.shipGroup.shipTo.postalAddress.stateProvinceGeoId - if (this.shipGroup.shipTo.postalAddress.toName) { - const toNameSplit = this.shipGroup.shipTo.postalAddress.toName.split(" "); - toNameSplit.length > 0 && (this.address.firstName = toNameSplit[0]); - toNameSplit.length > 1 && (this.address.lastName = toNameSplit[1]); - } - + if (this.shipGroup.shipTo.postalAddress.toName) { + const toNameSplit = this.shipGroup.shipTo.postalAddress.toName.split(" "); + toNameSplit.length > 0 && (this.address.firstName = toNameSplit[0]); + toNameSplit.length > 1 && (this.address.lastName = toNameSplit[1]); + } }, async getAssociatedStates() { try { diff --git a/src/views/Order.vue b/src/views/Order.vue index bcbd4fb0..eb7778bb 100644 --- a/src/views/Order.vue +++ b/src/views/Order.vue @@ -333,6 +333,7 @@ export default defineComponent({ if (result.role) { // role will have the passed data shipGroup.updatedAddress = result.role + console.log('shipGroup.updatedAddress', shipGroup.updatedAddress) } }); return modal.present(); From f1b1205a7a7dbc130c5b59f8a806fc40e74b399d Mon Sep 17 00:00:00 2001 From: Yash Maheshwari Date: Fri, 7 Jun 2024 16:35:06 +0530 Subject: [PATCH 2/2] Removed: unwanted console statement --- src/views/Order.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/src/views/Order.vue b/src/views/Order.vue index eb7778bb..bcbd4fb0 100644 --- a/src/views/Order.vue +++ b/src/views/Order.vue @@ -333,7 +333,6 @@ export default defineComponent({ if (result.role) { // role will have the passed data shipGroup.updatedAddress = result.role - console.log('shipGroup.updatedAddress', shipGroup.updatedAddress) } }); return modal.present();