Skip to content

Commit

Permalink
Improved: making async await shipping function call (#244)
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghbais committed Oct 9, 2023
1 parent 8c0348f commit f3dba0c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions src/views/Completed.vue
Original file line number Diff line number Diff line change
Expand Up @@ -388,12 +388,12 @@ export default defineComponent({
showBackdrop: false,
});
popover.onDidDismiss().then((result) => {
popover.onDidDismiss().then(async(result) => {
const selectedMethod = result.data.selectedMethod
// Calls method which is clicked on the popover, functions name returns when popover dismiss.
if(typeof(this[selectedMethod]) === 'function') {
(this as any)[selectedMethod](order);
await (this as any)[selectedMethod](order);
}
})
Expand Down
6 changes: 3 additions & 3 deletions src/views/ShippingPopover.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<ion-item button :disabled="!hasPermission(Actions.APP_UNPACK_ORDER) || order.hasMissingShipmentInfo || order.hasMissingPackageInfo || !hasPackedShipments" @click="closeModal('unpackOrder')">
{{ $t("Unpack") }}
</ion-item>
<ion-item button v-if="order.missingLabelImage" lines="none" @click="closeModal('showShippingLabelErrorModal')">
<ion-item button :disabled="!order.missingLabelImage" lines="none" @click="closeModal('showShippingLabelErrorModal')">
{{ $t("Shipping label error") }}
</ion-item>
</ion-list>
Expand All @@ -36,9 +36,9 @@ export default defineComponent({
},
props: ['hasPackedShipments', 'order'],
methods: {
closeModal(eventName: string) {
closeModal(selectedMethod: string) {
// Sending function name to be called after popover dismiss.
popoverController.dismiss({selectedMethod: eventName})
popoverController.dismiss({selectedMethod: selectedMethod})
}
},
setup() {
Expand Down

0 comments on commit f3dba0c

Please sign in to comment.