Use event Context

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-01-19 10:06:54 +01:00
parent a4acd23b77
commit ca8253a921
2 changed files with 18 additions and 21 deletions
@@ -1,13 +1,15 @@
import styles from "./createEventBtn.module.css"
import { useState } from "react";
import { useState, useContext } from "react";
import Modal from "../ui/modal/modal.jsx";
import Button from "../ui/button/button.jsx";
import TextInput from "../ui/input/input.jsx";
import createEvent from "../../utils/events/createEvent.js"
import { EventContext } from "../../contexts/events/EventContext.js";
export default function CreateEventBtn() {
const { addEvent } = useContext(EventContext);
const [isOpen, setIsOpen] = useState(false);
const [name, setName] = useState("");
const [description, setDescription] = useState("");
@@ -17,8 +19,7 @@ export default function CreateEventBtn() {
const handleCreateEvent = async () => {
if(name !== "" || description !== "" || start !== "" || end !== "") {
await createEvent(name, description, start, end);
console.log(start);
await addEvent(name, description, start, end);
}
setIsOpen(false);
}