From 6e38ff7ac7996614b80228d45f54523711942afc Mon Sep 17 00:00:00 2001 From: jedi Date: Tue, 5 Nov 2024 23:32:53 +0100 Subject: [PATCH] use an 'AsyncButton' that waits for completion of an async onClick handler for mail replies and comments in tickets --- web/src/components/Timeline.vue | 24 ++++++------ web/src/components/inputs/AsyncButton.vue | 47 +++++++++++++++++++++++ 2 files changed, 58 insertions(+), 13 deletions(-) create mode 100644 web/src/components/inputs/AsyncButton.vue diff --git a/web/src/components/Timeline.vue b/web/src/components/Timeline.vue index 97c8463..88bfa94 100644 --- a/web/src/components/Timeline.vue +++ b/web/src/components/Timeline.vue @@ -40,10 +40,10 @@
- +
@@ -58,10 +58,10 @@
- +
@@ -77,11 +77,12 @@ import {mapActions, mapGetters} from "vuex"; import TimelineAssignment from "@/components/TimelineAssignment.vue"; import TimelineRelatedItem from "@/components/TimelineRelatedItem.vue"; import TimelineShippingVoucher from "@/components/TimelineShippingVoucher.vue"; +import AsyncButton from "@/components/inputs/AsyncButton.vue"; export default { name: 'Timeline', components: { - TimelineShippingVoucher, + TimelineShippingVoucher, AsyncButton, TimelineRelatedItem, TimelineAssignment, TimelineStateChange, TimelineComment, TimelineMail }, props: { @@ -103,18 +104,15 @@ export default { }, }, methods: { - ...mapActions(['fetchShippingVouchers']), - sendMailAndClear: function () { - this.$emit('sendMail', this.newMail); + ...mapActions(['sendMail', 'postComment']), + sendMailAndClear: async function () { + await this.sendMail(this.newMail); this.newMail = ""; }, - addCommentAndClear: function () { - this.$emit('addComment', this.newComment); + addCommentAndClear: async function () { + await this.postComment(this.newComment); this.newComment = ""; } - }, - mounted() { - this.fetchShippingVouchers(); } }; diff --git a/web/src/components/inputs/AsyncButton.vue b/web/src/components/inputs/AsyncButton.vue new file mode 100644 index 0000000..a3c1712 --- /dev/null +++ b/web/src/components/inputs/AsyncButton.vue @@ -0,0 +1,47 @@ + + + + + \ No newline at end of file