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