mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-11-26 05:34:21 -05:00
Add Database Layer for Recipe Scaling (#506)
* move badge * fix add individual ingredient * fix redirect issue Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
@@ -31,6 +31,7 @@ const apiReq = {
|
||||
post: async function(url, data, getErrorText = defaultErrorText, getSuccessText) {
|
||||
const response = await axios.post(url, data).catch(function(error) {
|
||||
handleError(error, getErrorText);
|
||||
return error;
|
||||
});
|
||||
return handleResponse(response, getSuccessText);
|
||||
},
|
||||
@@ -38,6 +39,7 @@ const apiReq = {
|
||||
put: async function(url, data, getErrorText = defaultErrorText, getSuccessText) {
|
||||
const response = await axios.put(url, data).catch(function(error) {
|
||||
handleError(error, getErrorText);
|
||||
return error;
|
||||
});
|
||||
return handleResponse(response, getSuccessText);
|
||||
},
|
||||
@@ -45,6 +47,7 @@ const apiReq = {
|
||||
patch: async function(url, data, getErrorText = defaultErrorText, getSuccessText) {
|
||||
const response = await axios.patch(url, data).catch(function(error) {
|
||||
handleError(error, getErrorText);
|
||||
return error;
|
||||
});
|
||||
return handleResponse(response, getSuccessText);
|
||||
},
|
||||
@@ -52,12 +55,14 @@ const apiReq = {
|
||||
get: async function(url, data, getErrorText = defaultErrorText) {
|
||||
return axios.get(url, data).catch(function(error) {
|
||||
handleError(error, getErrorText);
|
||||
return error;
|
||||
});
|
||||
},
|
||||
|
||||
delete: async function(url, data, getErrorText = defaultErrorText, getSuccessText = defaultSuccessText) {
|
||||
const response = await axios.delete(url, data).catch(function(error) {
|
||||
handleError(error, getErrorText);
|
||||
return error;
|
||||
});
|
||||
return handleResponse(response, getSuccessText);
|
||||
},
|
||||
|
||||
@@ -35,9 +35,11 @@ export const recipeAPI = {
|
||||
},
|
||||
|
||||
async requestDetails(recipeSlug) {
|
||||
let response = await apiReq.get(API_ROUTES.recipesRecipeSlug(recipeSlug));
|
||||
if (response && response.data) return response.data;
|
||||
else return null;
|
||||
const response = await apiReq.get(API_ROUTES.recipesRecipeSlug(recipeSlug));
|
||||
if (response.response) {
|
||||
return response.response;
|
||||
}
|
||||
return response;
|
||||
},
|
||||
|
||||
updateImage(recipeSlug, fileObject, overrideSuccessMsg = false) {
|
||||
|
||||
Reference in New Issue
Block a user