feat: podpora notifikací z notify - základ

This commit is contained in:
2023-10-12 19:09:32 +02:00
parent 74893c38eb
commit 076f96aba6
6 changed files with 79 additions and 22 deletions

View File

@@ -19,7 +19,7 @@ import Footer from './components/Footer';
import { faChainBroken, faChevronLeft, faChevronRight, faGear, faSatelliteDish, faSearch } from '@fortawesome/free-solid-svg-icons';
import Loader from './components/Loader';
import { getData, errorHandler, getQrUrl } from './api/Api';
import { addChoice, removeChoices, removeChoice, changeDepartureTime } from './api/FoodApi';
import {addChoice, removeChoices, removeChoice, changeDepartureTime, jdemeObed} from './api/FoodApi';
const EVENT_CONNECT = "connect"
@@ -167,7 +167,11 @@ function App() {
}
}
}
const doJdemeObed=async ()=>{
if(auth?.login){
await jdemeObed()
}
}
const doAddFoodChoice = async (event: React.ChangeEvent<HTMLSelectElement>) => {
if (event.target.value && foodChoiceList?.length && choiceRef.current?.value) {
const restaurantKey = choiceRef.current.value;
@@ -475,10 +479,11 @@ function App() {
<FontAwesomeIcon icon={faGear} className='fa-spin' /> Zjišťujeme dostupné pizzy
</span>
:
<Button onClick={async () => {
<> <Button onClick={async () => {
setLoadingPizzaDay(true);
await createPizzaDay().then(() => setLoadingPizzaDay(false));
}}>Založit Pizza day</Button>
<Button onClick={doJdemeObed} style={{marginLeft:"14px"}}>Jdeme na oběd !</Button></>
}
</div>
}

View File

@@ -17,3 +17,6 @@ export const removeChoice = async (locationIndex: number, foodIndex: number, day
export const changeDepartureTime = async (time: string, dayIndex?: number) => {
return await api.post<any, any>(`${FOOD_API_PREFIX}/changeDepartureTime`, JSON.stringify({ time, dayIndex }));
}
export const jdemeObed = async () => {
return await api.post<any, any>(`${FOOD_API_PREFIX}/jdemeObed`, JSON.stringify({}));
}