"use client"; import { useSupabase } from "@/app/supabase-provider"; import Button from "@/lib/components/ui/Button"; import Card from "@/lib/components/ui/Card"; import Field from "@/lib/components/ui/Field"; import PageHeading from "@/lib/components/ui/PageHeading"; import { useToast } from "@/lib/hooks/useToast"; import Link from "next/link"; import { useState } from "react"; export default function SignUp() { const { supabase } = useSupabase(); const [email, setEmail] = useState(""); const [password, setPassword] = useState(""); const [isPending, setIsPending] = useState(false); const { publish } = useToast(); const handleSignUp = async () => { setIsPending(true); const { data, error } = await supabase.auth.signUp({ email: email, password: password, }); if (error) { console.error("Error signing up:", error.message); publish({ variant: "danger", text: `Error signing up: ${error.message}`, }); } else if (data) { publish({ variant: "success", text: "Confirmation Email sent, please check your email", }); } setIsPending(false); }; return (
{ e.preventDefault(); handleSignUp(); }} className="flex flex-col gap-2" > setEmail(e.target.value)} /> setPassword(e.target.value)} placeholder="Password" />
Already registered? Sign in
); }