import React, { FC, useState, FormEvent } from "react"; import { useRouteMatch } from "react-router-dom"; import { Modal } from "./Modal"; import { NewTicketForm } from "./NewTicketForm"; import { Ticket } from "../types/Ticket"; import { Project } from "../types/Project"; import { post } from "../utils/http"; import { Constants } from "../utils/Constants"; interface IProps { show: boolean; handleClose: () => void; allProjects: Project[]; } export const NewTicketModal: FC = ({ show, handleClose, allProjects }) => { const [title, setTitle] = useState(""); const [description, setDescription] = useState(""); const [endingDate, setEndingDate] = useState(""); const { url } = useRouteMatch(); const id = url.split("/")[2]; const [projectId, setProjectId] = useState(id); const handleSubmit: (event: FormEvent) => void = async ( e: FormEvent ) => { e.preventDefault(); let newTicket = { title: title, description: description, endingDate: new Date(endingDate).toISOString(), creatorId: "20bf4b2a-7209-4826-96cd-29c2bc937a94", projectId: parseInt(projectId) }; // const response: HttpResponse = await post(`${Constants.ticketsURI}`, newTicket); handleClose(); }; return (

New Ticket

close
); };