import { signIn, useSession } from "next-auth/react" import { useState, useEffect } from "react" import { useNDKContext } from "@/context/NDKContext"; import { Button } from 'primereact/button'; export default function SignIn() { const [email, setEmail] = useState("") const [nostrPubkey, setNostrPubkey] = useState("") const [nostrPrivkey, setNostrPrivkey] = useState("") const {ndk, addSigner} = useNDKContext(); const { data: session, status } = useSession(); // Get the current session's data and status useEffect(() => { console.log("session", session) }, [session]) const handleEmailSignIn = (e) => { e.preventDefault() signIn("email", { email }) } const handleNostrSignIn = async (e) => { e.preventDefault() if (!ndk.signer) { await addSigner(); } try { const user = await ndk.signer.user() const pubkey = user?._pubkey signIn("nostr", { pubkey }) } catch (error) { console.error("Error signing Nostr event:", error) } } const handleAnonymousSignIn = (e) => { e.preventDefault() signIn("anonymous") } return (

Sign In

) }