From 1a62ee732865a6646593737b388b7a829a977187 Mon Sep 17 00:00:00 2001 From: "masato.fujita" Date: Wed, 18 Jun 2025 13:08:03 +0900 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E5=BA=AB=E5=88=86=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E3=81=99=E3=82=8B=E9=87=8F=E3=82=92=E6=B8=9B=E3=82=89=E3=81=99?= =?UTF-8?q?=E6=A9=9F=E8=83=BD=E3=81=AE=E5=AE=9F=E8=A3=85=E3=80=81=E3=81=99?= =?UTF-8?q?=E3=81=A7=E3=81=AB=E5=9C=A8=E5=BA=AB=E3=81=AB=E7=99=BB=E9=8C=B2?= =?UTF-8?q?=E5=88=86=E3=81=82=E3=82=8B=E5=A0=B4=E5=90=88=E3=81=9D=E3=82=8C?= =?UTF-8?q?=E3=82=92=E3=83=A6=E3=83=BC=E3=82=B6=E3=81=AB=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E3=81=97=E3=81=A6=E3=83=AA=E3=82=B9=E3=83=88=E3=81=AB=E8=BF=BD?= =?UTF-8?q?=E5=8A=A0=E3=81=97=E3=81=AA=E3=81=84=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/pages/AddRecipe.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/AddRecipe.tsx b/frontend/src/pages/AddRecipe.tsx index 600ab79..ecff456 100644 --- a/frontend/src/pages/AddRecipe.tsx +++ b/frontend/src/pages/AddRecipe.tsx @@ -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}); // })) // }); - showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); + if (finalAddResult.data.length === 0) { + showSuccessMessage('必要な食材が在庫にあったのでリストには追加されませんでした!'); + } + else { + showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); + } navigate('/tasks'); }