コンソールundefined問題

feature_frontend_dishList_ui
masato.fujita 4 months ago
parent d72e746991
commit c490af7489
  1. 10
      frontend/src/pages/AddRecipe.tsx
  2. 5
      frontend/src/pages/RecipeList.tsx

@ -190,9 +190,13 @@ const AddRecipe: React.FC = () => {
}
const cancelNumOfPeopleDialog = async () => {
const recipeId = await handleSaveRecipe();
if (!recipeId) return false;
setOpenNumOfPeapleDialog(false);
// const allRecipes = await recipeApi.getAllRecipes();
// const allRecipesId = allRecipes.map(recipe => recipe.recipeId);
// const allStocks = await stockApi.getStocks();
// const allStuffIdAndAmount = [allStocks.map(stock => stock.stuffId), allStocks.map(stock => stock.amount)];
// Promise.all(allRecipesId.map(async recipe => {
// (await recipeApi.getById(recipe)
// }))
}
// コンポーネントマウント時にタスク一覧を取得

@ -28,7 +28,7 @@ import {
} from '@mui/material';
import {
Add as AddIcon, Delete as DeleteIcon, ShoppingBasket as ShoppingBasketIcon,
SoupKitchen as SoupKitchenIcon
SoupKitchen as SoupKitchenIcon, Close as CloseIcon, TaskAlt as TaskAltIcon
} from '@mui/icons-material';
import { ToBuy, Stuff, RecipeWithId, RecipeDetail } from '../types/types';
import { useMessage } from '../components/MessageContext';
@ -50,6 +50,8 @@ const RecipeList: React.FC = () => {
try {
const recipes = await recipeApi.getAllRecipes();
setAllRecipes(recipes);
console.log("マックス");
console.log(recipes.map(recipe => recipe.maxServings))
} catch (error) {
showErrorMessage("レシピの取得に失敗しました。");
// console.error(`${TASK_ERRORS.FETCH_FAILED}:`, error);
@ -90,6 +92,7 @@ const RecipeList: React.FC = () => {
onClick={() => openRecipeById(recipe.recipeId)}
>
{recipe.recipeName}
{recipe.maxServings === 0 && <CloseIcon />}
</Button>
</FormGroup>
// </ListItem>

Loading…
Cancel
Save