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,10 +28,13 @@ async function confirm() {
if (props.promise) { if (props.promise) {
isLoading.value = true; isLoading.value = true;
try {
Object.assign(response, props.data); Object.assign(response, props.data);
await props.send(response); await props.promise(response);
} finally {
isLoading.value = false; isLoading.value = false;
} }
}
onDialogOK(response); onDialogOK(response);
} }

View File

@ -69,10 +69,14 @@ async function send() {
}; };
if (props.promise) { if (props.promise) {
isLoading.value = true; isLoading.value = true;
try {
Object.assign(response, props.data); Object.assign(response, props.data);
await props.promise(response); await props.promise(response);
} finally {
isLoading.value = false; 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) {
try {
await props.promise(props.data); 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,
}, },
}); });
} }