|
|
|
@ -154,7 +154,8 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
console.log("yes2"); |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
await toBuyApi.addByRecipe(recipeId, numOfPeaple, checked); |
|
|
|
|
const finalAddResult = await toBuyApi.addByRecipe(recipeId, numOfPeaple, checked); |
|
|
|
|
console.log(finalAddResult) |
|
|
|
|
// const recipeStuffInfo = (await recipeApi.getById(recipeId)).stuffAndAmountArray;
|
|
|
|
|
// const recipeStuffId = recipeStuffInfo.map(item => item.stuffId);
|
|
|
|
|
// console.log(recipeStuffId);
|
|
|
|
@ -173,7 +174,12 @@ const AddRecipe: React.FC = () => { |
|
|
|
|
// stuffId: item.stuffId});
|
|
|
|
|
// }))
|
|
|
|
|
// });
|
|
|
|
|
if (finalAddResult.data.length === 0) { |
|
|
|
|
showSuccessMessage('必要な食材が在庫にあったのでリストには追加されませんでした!'); |
|
|
|
|
} |
|
|
|
|
else { |
|
|
|
|
showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); |
|
|
|
|
} |
|
|
|
|
navigate('/tasks'); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|