mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-23 06:45:22 -07:00
fix: Reset cached recipe when edit is closed
This commit is contained in:
parent
28047d9b58
commit
30c639c5de
1 changed files with 3 additions and 2 deletions
|
@ -234,7 +234,7 @@ export default defineComponent({
|
||||||
|
|
||||||
onUnmounted(async () => {
|
onUnmounted(async () => {
|
||||||
const isSame = JSON.stringify(props.recipe) === JSON.stringify(originalRecipe.value);
|
const isSame = JSON.stringify(props.recipe) === JSON.stringify(originalRecipe.value);
|
||||||
if (isEditMode.value && !isSame && props.recipe?.slug !== undefined) {
|
if (!isSame && props.recipe?.slug !== undefined) {
|
||||||
const save = window.confirm(
|
const save = window.confirm(
|
||||||
i18n.tc("general.unsaved-changes"),
|
i18n.tc("general.unsaved-changes"),
|
||||||
);
|
);
|
||||||
|
@ -274,7 +274,8 @@ export default defineComponent({
|
||||||
const { data } = await api.recipes.updateOne(props.recipe.slug, props.recipe);
|
const { data } = await api.recipes.updateOne(props.recipe.slug, props.recipe);
|
||||||
setMode(PageMode.VIEW);
|
setMode(PageMode.VIEW);
|
||||||
if (data?.slug) {
|
if (data?.slug) {
|
||||||
router.push(`/g/${groupSlug.value}/r/` + data.slug);
|
Object.assign(originalRecipe.value, props.recipe);
|
||||||
|
router.push(`/g/${groupSlug.value}/r/${data.slug}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue