AddAddress: rename callback method

This commit is contained in:
Mathieu Jaumotte 2021-09-16 20:49:46 +02:00
parent f66df3b77c
commit c58d1eccc5
2 changed files with 11 additions and 18 deletions

View File

@ -3,7 +3,7 @@
v-bind:key="key" v-bind:key="key"
v-bind:context="context" v-bind:context="context"
v-bind:options="options" v-bind:options="options"
v-bind:addressChanged="submitAddress" v-bind:addressChangedCallback="submitAddress"
ref="addAddress"> ref="addAddress">
</add-address> </add-address>
</template> </template>

View File

@ -128,7 +128,7 @@ import EditAddressPane from './EditAddressPane.vue';
export default { export default {
name: "AddAddress", name: "AddAddress",
props: ['context', 'options', 'addressChanged'], props: ['context', 'options', 'addressChangedCallback'],
components: { components: {
Modal, Modal,
ShowAddressPane, ShowAddressPane,
@ -413,16 +413,14 @@ export default {
}) })
.then(payload => { .then(payload => {
console.log('payload', payload); console.log('payload', payload);
this.addressChanged(payload); this.closePaneAndCallbackSubmit(payload);
} }
); );
} else { } else {
this.addNewAddress(newAddress) this.addNewAddress(newAddress)
.then(payload => this.addressChanged(payload)); .then(payload => this.closePaneAndCallbackSubmit(payload));
} }
}, },
/* /*
@ -518,24 +516,19 @@ export default {
}, },
/* /*
* Method called by parent when submitting address * Method just add closing pane to the callback method
* (get out step1 show pane, submit button) * (get out step1 show pane, submit button)
submitNewAddress() */
closePaneAndCallbackSubmit(payload)
{ {
let payload = { console.log('close pane and call parent callback method', payload);
entity: this.context.entity.name,
entityId: this.context.entity.id,
addressId: this.entity.address.address_id
};
console.log('submitNewAddress return', payload); //this.initForm();
this.initForm();
this.flag.showPane = false; this.flag.showPane = false;
return payload; // callback props method from parent
this.addressChangedCallback(payload);
} }
*/
} }
} }
</script> </script>