import { useLocalStorage } from "react-use"; import { defaultHTML } from "./../../../utils/consts"; function Login({ html, children, }: { html?: string; children?: React.ReactNode; }) { const [, setStorage] = useLocalStorage("html_content"); const handleClick = async () => { if (html !== defaultHTML) { setStorage(html); } const request = await fetch("/api/login"); const res = await request.json(); if (res?.redirectUrl) { window.open(res.redirectUrl, "_blank"); } }; return ( <>
REQUIRED Login with Hugging Face
{children}
); } export default Login;