This commit is contained in:
parent
e55ee7c11e
commit
c9fa710070
@ -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 => {
|
||||||
@ -363,7 +363,7 @@ function App() {
|
|||||||
content = <h3>Chyba načtení dat</h3>
|
content = <h3>Chyba načtení dat</h3>
|
||||||
}
|
}
|
||||||
return <Col md={12} lg={3} className='mt-3'>
|
return <Col md={12} lg={3} className='mt-3'>
|
||||||
<h3 style={{ cursor: 'pointer' }} onClick={() => doAddClickFoodChoice(location)}>{location}</h3>
|
<h3 style={{ cursor: 'pointer' }} onClick={() => doAddClickFoodChoice(location)}>{LunchChoice[location]}</h3>
|
||||||
{menu?.lastUpdate && <small>Poslední aktualizace: {getHumanDateTime(new Date(menu.lastUpdate))}</small>}
|
{menu?.lastUpdate && <small>Poslední aktualizace: {getHumanDateTime(new Date(menu.lastUpdate))}</small>}
|
||||||
{content}
|
{content}
|
||||||
</Col>
|
</Col>
|
||||||
@ -651,7 +651,7 @@ function App() {
|
|||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
</>}
|
</> || "Jejda, něco se nám nepovedlo :("}
|
||||||
</div>
|
</div>
|
||||||
<Footer />
|
<Footer />
|
||||||
<NoteModal isOpen={noteModalOpen} onClose={() => setNoteModalOpen(false)} onSave={saveNote} />
|
<NoteModal isOpen={noteModalOpen} onClose={() => setNoteModalOpen(false)} onSave={saveNote} />
|
||||||
|
@ -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;
|
||||||
|
@ -1,8 +0,0 @@
|
|||||||
import { client } from '../../../types/gen/client.gen';
|
|
||||||
import { getToken } from '../Utils';
|
|
||||||
|
|
||||||
client.setConfig({
|
|
||||||
auth: () => getToken(),
|
|
||||||
});
|
|
||||||
|
|
||||||
export default client
|
|
@ -1,11 +1,11 @@
|
|||||||
import { defaultPlugins } from '@hey-api/openapi-ts';
|
// import { defaultPlugins } from '@hey-api/openapi-ts';
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
input: 'api.yml',
|
input: 'api.yml',
|
||||||
output: 'gen',
|
output: 'gen',
|
||||||
plugins: [
|
plugins: [
|
||||||
...defaultPlugins,
|
// ...defaultPlugins,
|
||||||
'@hey-api/client-fetch',
|
// '@hey-api/client-fetch',
|
||||||
{
|
{
|
||||||
enums: 'javascript',
|
enums: 'javascript',
|
||||||
name: '@hey-api/typescript',
|
name: '@hey-api/typescript',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user