import { useRouter } from 'next/router'; let url = process.env.NEXT_PUBLIC_URL export default function Signup() { const router = useRouter(); let signup = async (event) => { event.preventDefault(); let username = (document.getElementById("Username") as HTMLInputElement).value; let email = (document.getElementById("Email") as HTMLInputElement).value; let password = (document.getElementById("Password") as HTMLInputElement).value; let token = await fetch(`http://${url}/signup`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, mode: "cors", body: JSON.stringify({ "Username": username, "Email": email, "Password": password }) }).then(r => r.json()); if (token["status"] == "ok") { router.push('/login') } else { alert("Username already exists"); } } return (

Copybook

Signup

) }