From d65b11db7bbfc02b669bf61e773b3bdf60a28801 Mon Sep 17 00:00:00 2001 From: Martin Berka Date: Wed, 5 Mar 2025 22:59:00 +0100 Subject: [PATCH] =?UTF-8?q?Oprava=20datov=C3=BDch=20typ=C5=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- client/src/App.tsx | 6 +++--- client/src/api/Api.ts | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/client/src/App.tsx b/client/src/App.tsx index 3a50a20..bfa294b 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -68,11 +68,11 @@ function App() { if (!auth?.login) { return } - getData().then(({ data }) => { + getData().then(data => { if (data) { setData(data); - setDayIndex(data.weekIndex); - dayIndexRef.current = data.weekIndex; + setDayIndex(data.dayIndex); + dayIndexRef.current = data.dayIndex; setFood(data.menus); } }).catch(e => { diff --git a/client/src/api/Api.ts b/client/src/api/Api.ts index a8666b6..0bed18f 100644 --- a/client/src/api/Api.ts +++ b/client/src/api/Api.ts @@ -1,5 +1,6 @@ import { toast } from "react-toastify"; import { getToken } from "../Utils"; +import { ClientData } from "../../../types"; /** * Wrapper pro volání API, u kterých chceme automaticky zobrazit toaster s chybou ze serveru. @@ -70,7 +71,7 @@ export const getQrUrl = (login: string) => { return `/api/qr?login=${login}`; } -export const getData = async (dayIndex?: number) => { +export const getData = async (dayIndex?: number): Promise => { let url = '/api/data'; if (dayIndex != null) { url += '?dayIndex=' + dayIndex;