1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-02 20:15:24 +02:00

fix: Mealplans Disappearing/Can't be edited (#4379)

This commit is contained in:
Michael Genson 2024-10-17 03:45:50 -05:00 committed by GitHub
parent c40d2d0486
commit 79b36024a4
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 8 additions and 5 deletions

View file

@ -220,7 +220,7 @@
</template>
<script lang="ts">
import { defineComponent, computed, reactive, ref, watch, onMounted } from "@nuxtjs/composition-api";
import { defineComponent, computed, reactive, ref, watch, onMounted, useContext } from "@nuxtjs/composition-api";
import { format } from "date-fns";
import { SortableEvent } from "sortablejs";
import draggable from "vuedraggable";
@ -249,6 +249,7 @@ export default defineComponent({
},
setup(props) {
const api = useUserApi();
const { $auth } = useContext();
const { household } = useHouseholdSelf();
const state = ref({
@ -309,6 +310,7 @@ export default defineComponent({
existing: false,
id: 0,
groupId: "",
userId: $auth.user?.id || "",
});
function openDialog(date: Date) {
@ -317,17 +319,18 @@ export default defineComponent({
}
function editMeal(mealplan: UpdatePlanEntry) {
const { date, title, text, entryType, recipeId, id, groupId } = mealplan;
const { date, title, text, entryType, recipeId, id, groupId, userId } = mealplan;
if (!entryType) return;
newMeal.date = date;
newMeal.title = title || "";
newMeal.text = text || "";
newMeal.recipeId = recipeId;
newMeal.recipeId = recipeId || undefined;
newMeal.entryType = entryType;
newMeal.existing = true;
newMeal.id = id;
newMeal.groupId = groupId;
newMeal.userId = userId || $auth.user?.id || "";
state.value.dialog = true;
dialog.note = !recipeId;