|
|
|
@ -132,11 +132,11 @@ export const toBuyApi = { |
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
addByRecipe: async (recipeId: number): Promise<any> => { |
|
|
|
|
addByRecipe: async (recipeId: number, servings: number): Promise<any> => { |
|
|
|
|
const response = await fetch(`${API_BASE_URL}/api/tobuy/addByRecipe`, { |
|
|
|
|
method: 'POST', |
|
|
|
|
headers: getHeaders(), |
|
|
|
|
body: JSON.stringify({ recipeId }), |
|
|
|
|
body: JSON.stringify({ recipeId, servings }), |
|
|
|
|
}) |
|
|
|
|
if (!response.ok) { |
|
|
|
|
throw new Error(TOBUY_ERRORS.CREATE_FAILED); |
|
|
|
|