レシピから追加のAPIを修正

feature-frontend-recipe-api
Masaharu.Kato 4 months ago
parent dfe4a3ff14
commit 2c59dc9484
  1. 4
      frontend/src/services/api.ts

@ -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`, { const response = await fetch(`${API_BASE_URL}/api/tobuy/addByRecipe`, {
method: 'POST', method: 'POST',
headers: getHeaders(), headers: getHeaders(),
body: JSON.stringify({ recipeId }), body: JSON.stringify({ recipeId, servings }),
}) })
if (!response.ok) { if (!response.ok) {
throw new Error(TOBUY_ERRORS.CREATE_FAILED); throw new Error(TOBUY_ERRORS.CREATE_FAILED);

Loading…
Cancel
Save