This commit is contained in:
parent
cc2cd77cea
commit
d65b11db7b
@ -68,11 +68,11 @@ function App() {
|
|||||||
if (!auth?.login) {
|
if (!auth?.login) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
getData().then(({ data }) => {
|
getData().then(data => {
|
||||||
if (data) {
|
if (data) {
|
||||||
setData(data);
|
setData(data);
|
||||||
setDayIndex(data.weekIndex);
|
setDayIndex(data.dayIndex);
|
||||||
dayIndexRef.current = data.weekIndex;
|
dayIndexRef.current = data.dayIndex;
|
||||||
setFood(data.menus);
|
setFood(data.menus);
|
||||||
}
|
}
|
||||||
}).catch(e => {
|
}).catch(e => {
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { toast } from "react-toastify";
|
import { toast } from "react-toastify";
|
||||||
import { getToken } from "../Utils";
|
import { getToken } from "../Utils";
|
||||||
|
import { ClientData } from "../../../types";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Wrapper pro volání API, u kterých chceme automaticky zobrazit toaster s chybou ze serveru.
|
* 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}`;
|
return `/api/qr?login=${login}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const getData = async (dayIndex?: number) => {
|
export const getData = async (dayIndex?: number): Promise<ClientData> => {
|
||||||
let url = '/api/data';
|
let url = '/api/data';
|
||||||
if (dayIndex != null) {
|
if (dayIndex != null) {
|
||||||
url += '?dayIndex=' + dayIndex;
|
url += '?dayIndex=' + dayIndex;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user