diff --git a/client/src/components/NewTicketModal.tsx b/client/src/components/NewTicketModal.tsx index 60d6a86..03c7ccd 100644 --- a/client/src/components/NewTicketModal.tsx +++ b/client/src/components/NewTicketModal.tsx @@ -1,11 +1,12 @@ -import React, { FC, useState, useEffect, FormEvent } from "react"; +import React, { FC, useState, FormEvent } from "react"; +import { useParams, 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"; import { HttpResponse } from "../types/HttpResponse"; -import { NewTicketForm } from "./NewTicketForm"; -import { Project } from "../types/Project"; interface IProps { show: boolean; @@ -21,7 +22,10 @@ export const NewTicketModal: FC = ({ const [title, setTitle] = useState(""); const [description, setDescription] = useState(""); const [endingDate, setEndingDate] = useState(""); - const [projectId, setProjectId] = useState("0"); + + const { url } = useRouteMatch(); + const id = url.split("/")[2]; + const [projectId, setProjectId] = useState(id); const handleSubmit: (event: FormEvent) => void = async ( e: FormEvent @@ -43,7 +47,6 @@ export const NewTicketModal: FC = ({ handleClose(); }; - useEffect(() => {}); return (