0
0
Fork 0
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) {
isLoading.value = true;
Object.assign(response, props.data);
await props.send(response);
isLoading.value = false;
try {
Object.assign(response, props.data);
await props.promise(response);
} finally {
isLoading.value = false;
}
}
onDialogOK(response);

View File

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

View File

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

View File

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