feat(mobile): MIKRO MEAL-2 tidsstyrd måltid i Vad ska vi äta

This commit is contained in:
Sven (AAMOS AI)
2026-08-17 21:41:59 +07:00
parent 6fe1955c9f
commit 6dcc404dc1
+5 -2
View File
@@ -56,11 +56,14 @@ export default function WhatToEatScreen() {
const [page, setPage] = useState(0); const [page, setPage] = useState(0);
const { track } = useAnalytics(); const { track } = useAnalytics();
const hour = new Date().getHours();
const currentMeal = hour < 10 ? "breakfast" : hour < 14 ? "lunch" : "dinner";
const query = useQuery({ const query = useQuery({
queryKey: ["what-to-eat", submittedCraving], queryKey: ["what-to-eat", submittedCraving, currentMeal],
queryFn: () => queryFn: () =>
api<WhatToEatResponse>( api<WhatToEatResponse>(
`/v1/recommendations/what-to-eat?limit=15&view=pantry${submittedCraving ? `&craving=${encodeURIComponent(submittedCraving)}` : ""}`, `/v1/recommendations/what-to-eat?limit=15&view=pantry&mealType=${currentMeal}${submittedCraving ? `&craving=${encodeURIComponent(submittedCraving)}` : ""}`,
), ),
}); });