This commit is contained in:
Joan Sanchez 2023-03-10 13:04:48 +01:00
parent ad4e85b080
commit f546e36693
4 changed files with 21 additions and 9 deletions

View File

@ -28,9 +28,12 @@ async function confirm() {
if (props.promise) { if (props.promise) {
isLoading.value = true; isLoading.value = true;
Object.assign(response, props.data); try {
await props.send(response); Object.assign(response, props.data);
isLoading.value = false; await props.promise(response);
} finally {
isLoading.value = false;
}
} }
onDialogOK(response); onDialogOK(response);

View File

@ -69,9 +69,13 @@ async function send() {
}; };
if (props.promise) { if (props.promise) {
isLoading.value = true; isLoading.value = true;
Object.assign(response, props.data);
await props.promise(response); try {
isLoading.value = false; Object.assign(response, props.data);
await props.promise(response);
} finally {
isLoading.value = false;
}
} }
onDialogOK(response); onDialogOK(response);

View File

@ -41,9 +41,12 @@ const isLoading = ref(false);
async function confirm() { async function confirm() {
isLoading.value = true; isLoading.value = true;
if (props.promise) { if (props.promise) {
await props.promise(props.data); try {
await props.promise(props.data);
} finally {
isLoading.value = false;
}
} }
isLoading.value = false;
onDialogOK(props.data); onDialogOK(props.data);
} }
</script> </script>
@ -78,6 +81,8 @@ async function confirm() {
color="primary" color="primary"
:loading="isLoading" :loading="isLoading"
@click="confirm()" @click="confirm()"
unelevated
autofocus
/> />
</q-card-actions> </q-card-actions>
</q-card> </q-card>

View File

@ -43,7 +43,7 @@ function sendDeliveryNoteConfirmation(type = 'deliveryNote', documentType = 'pdf
type: type, type: type,
documentType: documentType, documentType: documentType,
}, },
send: sendDeliveryNote, promise: sendDeliveryNote,
}, },
}); });
} }