"use client"; import { useState } from "react"; import Link from "next/link"; import { useRouter } from "next/navigation"; import AuthShell, { Field } from "@/components/AuthShell"; import { GoogleButton, OrDivider } from "@/components/GoogleAuth"; import { api, setToken } from "@/lib/api"; export default function Signup() { const r = useRouter(); const [form, setForm] = useState({ name: "", email: "", password: "" }); const [err, setErr] = useState(""); const [loading, setLoading] = useState(false); async function submit(e: React.FormEvent) { e.preventDefault(); setErr(""); setLoading(true); try { const res = await api("/auth/signup", { method: "POST", body: JSON.stringify(form) }); setToken(res.access_token); r.push(`/verify-email?email=${encodeURIComponent(form.email)}`); } catch (e: any) { setErr(typeof e.detail === "string" ? e.detail : "Signup failed"); } finally { setLoading(false); } } const set = (k: string) => (e: any) => setForm({ ...form, [k]: e.target.value }); return (
{err &&

{err}

}

Already have an account? Log In

); }