diff --git a/frontend/src/pages/AddRecipe.tsx b/frontend/src/pages/AddRecipe.tsx index 2bb15fc..a4f52ab 100644 --- a/frontend/src/pages/AddRecipe.tsx +++ b/frontend/src/pages/AddRecipe.tsx @@ -86,17 +86,17 @@ const AddRecipe: React.FC = () => { const handleSaveRecipe = async () => { - // if (!recipeName) { - // showErrorMessage('レシピ名が入力されていません!') - // console.log("yes1"); - // return false; - // } - - // if (!items.length) { - // showErrorMessage('材料が追加されていません!') - // console.log("yes2"); - // return false; - // } + if (!recipeName) { + showErrorMessage('レシピ名が入力されていません!') + console.log("yes1"); + return false; + } + + if (!items.length) { + showErrorMessage('材料が追加されていません!') + console.log("yes2"); + return false; + } try { if (!recipeId) { @@ -127,13 +127,13 @@ const AddRecipe: React.FC = () => { const checkRecipeAndItems = async () => { if (!recipeName) { - alert('レシピ名が入力されていません!') + showErrorMessage('レシピ名が入力されていません!') console.log("yes1"); return false; } if (!items.length) { - alert('材料が追加されていません!') + showErrorMessage('材料が追加されていません!') console.log("yes2"); return false; } @@ -154,7 +154,7 @@ const AddRecipe: React.FC = () => { console.log("before"); if (!recipeId) return false; console.log("ds"); - await toBuyApi.addByRecipe(recipeId); + await toBuyApi.addByRecipe(recipeId, numOfPeaple); showSuccessMessage('レシピが保存されて買うものリストに追加されました!'); navigate('/tasks'); } @@ -312,12 +312,13 @@ const AddRecipe: React.FC = () => { setOpenAmountDialog(false); }} /> + {/* 人数入力ダイアログ */} setOpenNumOfPeapleDialog(false)} disableScrollLock={true} style={{ width : '100%', position : 'fixed', left: '50%', transform: 'translateX(-50%)' }} > - 何人前かを入力 + 買うものリストへ追加
@@ -343,10 +344,10 @@ const AddRecipe: React.FC = () => { -
diff --git a/frontend/src/pages/StockPage.tsx b/frontend/src/pages/StockPage.tsx index b359f94..981464f 100644 --- a/frontend/src/pages/StockPage.tsx +++ b/frontend/src/pages/StockPage.tsx @@ -39,13 +39,6 @@ const formatDateLocal = (date: Date) => { return `${year}-${month}-${day}`; }; -// 日付をyyyy-MM-dd形式で返す関数 -const formatDateLocal = (date: Date) => { - const year = date.getFullYear(); - const month = (date.getMonth() + 1).toString().padStart(2, '0'); - const day = date.getDate().toString().padStart(2, '0'); - return `${year}-${month}-${day}`; -}; // 新規在庫の初期状態 const EMPTY_STOCK: Omit & { stuffId: number | null } & { newAddition: boolean } = {