Convert CreateEventBtn to Typescript

This commit is contained in:
T'JAMPENS QUENTIN p2406187
2026-03-18 21:02:25 +01:00
parent 724ae99b29
commit fe814118b0
2 changed files with 10 additions and 9 deletions
@@ -4,19 +4,19 @@ import Modal from "../../../ui/Modal/Modal";
import Button from "../../../ui/Button/Button";
import TextInput from "../../../ui/Input/Input";
import { EventContext } from "../../../../contexts/Events/EventContext.js";
import {AuthContext} from "../../../../contexts/Auth/AuthContext.ts";
import { AuthContext } from "../../../../contexts/Auth/AuthContext";
export default function CreateEventBtn() {
const { addEvent } = useContext(EventContext);
const { user } = useContext(AuthContext);
const { addEvent } = useContext(EventContext)!;
const { user } = useContext(AuthContext)!;
const [isOpen, setIsOpen] = useState(false);
const [name, setName] = useState("");
const [description, setDescription] = useState("");
const [start, setStart] = useState("");
const [end, setEnd] = useState("");
const [isOpen, setIsOpen] = useState<boolean>(false);
const [name, setName] = useState<string>("");
const [description, setDescription] = useState<string>("");
const [start, setStart] = useState<string>("");
const [end, setEnd] = useState<string>("");
const handleCreateEvent = async () => {
+1
View File
@@ -17,6 +17,7 @@ export type EventGroup = {
export type EventContextType = {
events: EventGroup[];
updateEvent: () => void;
addEvent: (name: string, description: string, start: string, end: string) => Promise<void>;
};
export const EventContext = createContext<EventContextType | null>(null);