mirror of
https://github.com/hay-kot/mealie.git
synced 2025-08-22 14:33:33 -07:00
Fix messed up merge
This commit is contained in:
parent
d6f0291a27
commit
937df8b87d
1 changed files with 27 additions and 7 deletions
|
@ -79,16 +79,36 @@ export const recipeAPI = {
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
|
|
||||||
async updateImagebyURL(slug, url) {
|
async createAsset(recipeSlug, fileObject, name, icon) {
|
||||||
const response = apiReq.post(recipeURLs.updateImage(slug), { url: url });
|
const fd = new FormData();
|
||||||
|
fd.append("file", fileObject);
|
||||||
|
fd.append("extension", fileObject.name.split(".").pop());
|
||||||
|
fd.append("name", name);
|
||||||
|
fd.append("icon", icon);
|
||||||
|
let response = apiReq.post(recipeURLs.createAsset(recipeSlug), fd);
|
||||||
return response;
|
return response;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
updateImagebyURL(slug, url) {
|
||||||
|
return apiReq.post(
|
||||||
|
recipeURLs.updateImage(slug),
|
||||||
|
{ url: url },
|
||||||
|
function() { return i18n.t('general.image-upload-failed'); },
|
||||||
|
function() { return i18n.t('recipe.recipe-image-updated'); }
|
||||||
|
);
|
||||||
|
},
|
||||||
|
|
||||||
async update(data) {
|
async update(data) {
|
||||||
console.log(data)
|
let response = await apiReq.put(
|
||||||
let response = await apiReq.put(recipeURLs.update(data.slug), data);
|
recipeURLs.update(data.slug),
|
||||||
store.dispatch("patchRecipe", response.data);
|
data,
|
||||||
return response.data.slug; // ! Temporary until I rewrite to refresh page without additional request
|
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) {
|
async patch(data) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue