import React, { useRef, useState } from "react"; import { X } from "react-feather"; import Workspace from "../../models/workspace"; const noop = () => false; export default function NewWorkspaceModal({ hideModal = noop }) { const formEl = useRef(null); const [error, setError] = useState(null); const handleCreate = async (e) => { setError(null); e.preventDefault(); const data = {}; const form = new FormData(formEl.current); for (var [key, value] of form.entries()) data[key] = value; const { workspace, message } = await Workspace.new(data); if (!!workspace) window.location.reload(); setError(message); }; return (