Skip to content

Commit

Permalink
Fixed: issue of address not updating inside modal after reopening the…
Browse files Browse the repository at this point in the history
… modal
  • Loading branch information
ymaheshwari1 committed Jun 7, 2024
1 parent 6f4c893 commit 3ad4452
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
15 changes: 9 additions & 6 deletions src/views/AddressModal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
1 change: 1 addition & 0 deletions src/views/Order.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 3ad4452

Please sign in to comment.