1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-08-05 13:35:23 +02:00

feature/new-recipe-features (#360)

* unify button styles

* fix drag on mobile

* recipe instructions section

* add carbs

* refactor component location

* asset start

* consolidate view/edit components

* asset api

* base dialog event

* Remove 'content'

* remove console.log

* add slug prop

* remove console.log

* recipe assets first pass

* add recipeSettings model

* fix hide/show when no tags/categories

* fix typo

Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
Hayden 2021-04-28 18:59:37 -08:00 committed by GitHub
parent 9abb6f10fd
commit 04255e285f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 246 additions and 749 deletions

View file

@ -16,6 +16,7 @@ const recipeURLs = {
delete: slug => prefix + slug,
recipeImage: slug => `${prefix}${slug}/image`,
updateImage: slug => `${prefix}${slug}/image`,
createAsset: slug => `${prefix}${slug}/asset`,
};
export const recipeAPI = {
@ -60,12 +61,23 @@ export const recipeAPI = {
return response;
},
async createAsset(recipeSlug, fileObject, name, icon) {
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;
},
async updateImagebyURL(slug, url) {
const response = apiReq.post(recipeURLs.updateImage(slug), { url: url });
return response;
},
async update(data) {
console.log(data)
let response = await apiReq.put(recipeURLs.update(data.slug), data);
store.dispatch("patchRecipe", response.data);
return response.data.slug; // ! Temporary until I rewrite to refresh page without additional request