|
|
|
@ -84,23 +84,28 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
if (!recipeId) { |
|
|
|
|
// 新規追加
|
|
|
|
|
const response = await recipeApi.addRecipe({ |
|
|
|
|
try { |
|
|
|
|
if (!recipeId) { |
|
|
|
|
// 新規追加
|
|
|
|
|
const response = await recipeApi.addRecipe({ |
|
|
|
|
recipeName, |
|
|
|
|
summary: recipeSummary, |
|
|
|
|
stuffAndAmountArray: items, |
|
|
|
|
}) |
|
|
|
|
return response.recipeId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const response = await recipeApi.updateRecipe({ |
|
|
|
|
recipeId, |
|
|
|
|
recipeName, |
|
|
|
|
summary: recipeSummary, |
|
|
|
|
stuffAndAmountArray: items, |
|
|
|
|
}) |
|
|
|
|
return response.recipeId; |
|
|
|
|
} catch { |
|
|
|
|
alert('レシピの送信に失敗しました。既に同じ名前の料理が存在する可能性があります。'); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
const response = await recipeApi.updateRecipe({ |
|
|
|
|
recipeId, |
|
|
|
|
recipeName, |
|
|
|
|
summary: recipeSummary, |
|
|
|
|
stuffAndAmountArray: items, |
|
|
|
|
}) |
|
|
|
|
|
|
|
|
|
return recipeId; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|