import { CreatePorject } from "@/api/projects"; import { PrimaryButton } from "@/components/Button"; import MainLayout from "@/components/MainLayout"; import Head from "next/head"; import { useRouter } from "next/router"; import { useEffect, useState } from "react"; const CreateProjectPage = () => { const router = useRouter(); const [name, setName] = useState(""); const [apiResponse, setApiResponse] = useState(); async function formSubmit(e: React.FormEvent) { e.preventDefault(); let project = { Name: name }; CreatePorject(project, setApiResponse); } useEffect(() => { apiResponse && apiResponse.status === "OK" && router.push("/projects"); }, [apiResponse]); return ( Create Projects | Watchman

Create Project

setName(e.target.value)} className="w-80 border border-slate-200 p-1" />
); }; export default CreateProjectPage;