Oprava datových typů
All checks were successful
ci/woodpecker/push/workflow Pipeline was successful

This commit is contained in:
Martin Berka 2025-03-05 22:59:00 +01:00
parent cc2cd77cea
commit d65b11db7b
2 changed files with 5 additions and 4 deletions

View File

@ -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 => {

View File

@ -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<ClientData> => {
let url = '/api/data';
if (dayIndex != null) {
url += '?dayIndex=' + dayIndex;