import classNames from "classnames"; import { useState } from "react"; import { toast } from "react-toastify"; import SpaceIcon from "@/assets/space.svg"; import Loading from "../loading/loading"; import { Auth } from "../../../utils/types"; function LoadButton({ auth, setHtml, }: { auth?: Auth; setHtml: (html: string) => void; }) { const [open, setOpen] = useState(false); const [loading, setLoading] = useState(false); const [error, setError] = useState(false); const [path, setPath] = useState(undefined); const loadSpace = async () => { setLoading(true); try { const res = await fetch(`/api/remix/${path}`); const data = await res.json(); if (res.ok) { if (data.html) { setHtml(data.html); toast.success("Project loaded successfully."); } setOpen(false); } else { toast.error(data.message); setError(data.message); } // eslint-disable-next-line @typescript-eslint/no-explicit-any } catch (error: any) { toast.error(error.message); setError(error.message); } setLoading(false); }; return (

setOpen(!open)} > Load project

setOpen(false)} >
<>
Space Icon Space Load Project
{error && (

{error}

)}
); } export default LoadButton;