mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 06:23:34 -07:00
Add messages upon recipe updated
This commit is contained in:
parent
f0cf4e4c63
commit
9f361ba10f
3 changed files with 15 additions and 6 deletions
|
@ -88,9 +88,16 @@ export const recipeAPI = {
|
|||
},
|
||||
|
||||
async update(data) {
|
||||
let response = await apiReq.put(recipeURLs.update(data.slug), data);
|
||||
let response = await apiReq.put(
|
||||
recipeURLs.update(data.slug),
|
||||
data,
|
||||
function() { return i18n.t('recipe.recipe-update-failed'); },
|
||||
function() { return i18n.t('recipe.recipe-updated'); }
|
||||
);
|
||||
if(response) {
|
||||
store.dispatch("patchRecipe", response.data);
|
||||
return response.data.slug; // ! Temporary until I rewrite to refresh page without additional request
|
||||
}
|
||||
},
|
||||
|
||||
async patch(data) {
|
||||
|
|
|
@ -194,6 +194,8 @@
|
|||
"recipe-image": "Recipe Image",
|
||||
"recipe-image-updated": "Recipe image updated",
|
||||
"recipe-name": "Recipe Name",
|
||||
"recipe-update-failed": "Recipe update failed",
|
||||
"recipe-updated": "Recipe updated",
|
||||
"servings": "Servings",
|
||||
"sodium-content": "Sodium Content",
|
||||
"step-index": "Step: {step}",
|
||||
|
|
|
@ -180,9 +180,9 @@ export default {
|
|||
return this.$refs.recipeEditor.validateRecipe();
|
||||
}
|
||||
},
|
||||
async saveImage() {
|
||||
async saveImage(overrideSuccessMsg = false) {
|
||||
if (this.fileObject) {
|
||||
if (api.recipes.updateImage(this.recipeDetails.slug, this.fileObject)) {
|
||||
if (api.recipes.updateImage(this.recipeDetails.slug, this.fileObject, overrideSuccessMsg)) {
|
||||
this.imageKey += 1;
|
||||
}
|
||||
}
|
||||
|
@ -192,7 +192,7 @@ export default {
|
|||
let slug = await api.recipes.update(this.recipeDetails);
|
||||
|
||||
if (this.fileObject) {
|
||||
this.saveImage();
|
||||
this.saveImage(true);
|
||||
}
|
||||
|
||||
this.form = false;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue