wait for timelime event to finish before closing modal

This commit is contained in:
Michael Genson 2025-07-24 23:27:49 +00:00
commit 2e63d24e40

View file

@ -3,6 +3,7 @@
<div>
<BaseDialog
v-model="madeThisDialog"
:loading="madeThisFormLoading"
:icon="$globals.icons.chefHat"
:title="$t('recipe.made-this')"
:submit-text="$t('recipe.add-to-timeline')"
@ -196,12 +197,14 @@ export default defineNuxtComponent({
newTimelineEventImagePreviewUrl.value = URL.createObjectURL(fileObject);
}
const state = reactive({ datePickerMenu: false });
const state = reactive({ datePickerMenu: false, madeThisFormLoading: false });
async function createTimelineEvent() {
if (!(newTimelineEventTimestampString.value && props.recipe?.id && props.recipe?.slug)) {
return;
}
state.madeThisFormLoading = true;
newTimelineEvent.value.recipeId = props.recipe.id;
// Note: $auth.user is now a ref
newTimelineEvent.value.subject = i18n.t("recipe.user-made-this", { user: $auth.user.value?.fullName });
@ -236,6 +239,7 @@ export default defineNuxtComponent({
newTimelineEvent.value.timestamp = undefined;
clearImage();
madeThisDialog.value = false;
state.madeThisFormLoading = false;
domMadeThisForm.value?.reset();
context.emit("eventCreated", newEvent);