implemented popup (subject to change)

This commit is contained in:
mmacierzanka committed 2021-10-04 00:15:53 +02:00
1 parent 87e3a6c1b7
commit 5e7be5545d
1 file changed
+13 -1
+13 -1
View File
@@ -7,6 +7,7 @@ import { fromLonLat, toLonLat } from "ol/proj";
import { useHistory } from "react-router";
import { API_CLIENT, EVENT_CONTEXT } from "../../constants";
import styles from "./index.module.scss";
import { spawnPopup } from "../../utils/spawnPopup";
export const CreateEvent = () => {
const context = useContext(EVENT_CONTEXT);
@@ -23,7 +24,18 @@ export const CreateEvent = () => {
date: "0",
description: "",
},
onSubmit: (data) => {
onSubmit: async (data) => {
if (data.type === 0) {
await spawnPopup((close) => {
return (
<>
<h1>Nie podałeś typu wydarzenia</h1>
<button onClick={close}>Zamknij</button>
</>
);
});
return;
}
const cords = toLonLat([center[0], center[1]]);
const rqObj = {
name: data.name,