feat(modal): warn before closing with unsaved changes

This commit is contained in:
Ulas Kalayci
2026-04-26 19:03:38 +02:00
parent 798f8ca87a
commit ed0f8b2d57
27 changed files with 112 additions and 40 deletions
+3 -3
View File
@@ -326,8 +326,8 @@ function openRecipeModal(mode, recipe = null) {
});
}
function closeModal() {
closeSharedModal();
function closeModal({ force = false } = {}) {
closeSharedModal({ force });
}
async function saveRecipe(panel, mode, recipe) {
@@ -361,7 +361,7 @@ async function saveRecipe(panel, mode, recipe) {
if (idx >= 0) state.recipes[idx] = res.data;
}
closeModal();
closeModal({ force: true });
renderRecipeList();
window.oikos?.showToast(mode === 'create' ? t('recipes.created') : t('recipes.updated'), 'success');
} catch (err) {