feat(mobile): MIKRO MEAL-2 tidsstyrd måltid i Vad ska vi äta
This commit is contained in:
@@ -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)}` : ""}`,
|
||||||
),
|
),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user