Skip to content

Commit

Permalink
fix(food): food_id 로 통일
Browse files Browse the repository at this point in the history
  • Loading branch information
HyeonChae1104 committed Nov 15, 2024
1 parent be513f7 commit 9281480
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/hooks/useFoodPreferences.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ type UseFoodPreferencesOptions = {
preferences: number[];
setPreferences: (ids: number[]) => void;
onAddFood?: (food: Food) => void;
onRemoveFood?: (foodId: number) => void;
onRemoveFood?: (food_id: number) => void;
};

export const useFoodPreferences = ({
Expand Down Expand Up @@ -43,10 +43,10 @@ export const useFoodPreferences = ({
}
};

const handleFoodRemove = (foodId: number) => {
setSelectedFoods((prevFoods) => prevFoods.filter((food) => food.food_id !== foodId));
setPreferences(preferences.filter((id) => id !== foodId));
if (onRemoveFood) onRemoveFood(foodId);
const handleFoodRemove = (food_id: number) => {
setSelectedFoods((prevFoods) => prevFoods.filter((food) => food.food_id !== food_id));
setPreferences(preferences.filter((id) => id !== food_id));
if (onRemoveFood) onRemoveFood(food_id);
};

return {
Expand Down

0 comments on commit 9281480

Please sign in to comment.