'use client' import * as React from 'react' // import { useSearchParams } from 'next/navigation' // import { zodResolver } from '@hookform/resolvers/zod' // import { signIn } from 'next-auth/react' // import { useForm } from 'react-hook-form' // import * as z from 'zod' import { cn } from '@/lib/utils' import { userAuthSchema } from '@/lib/validations/auth' import { buttonVariants } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' // import { toast } from '@/components/ui/use-toast' import { Github, LoaderCircle } from 'lucide-react' interface UserAuthFormProps extends React.HTMLAttributes {} type FormData = z.infer export function UserAuthForm({ className, ...props }: UserAuthFormProps) { const signIn = (s: string) => console.log(s) const handleSubmit = (e: React.FormEvent) => { // e.preventDefault() signIn('github') } const errors = { email: 'This field is required', password: 'This field is required', } // const { // register, // handleSubmit, // formState: { errors }, // } = useForm({ // resolver: zodResolver(userAuthSchema), // }) const [isLoading, setIsLoading] = React.useState(false) const [isGitHubLoading, setIsGitHubLoading] = React.useState(false) // const searchParams = useSearchParams() async function onSubmit(data: FormData) { setIsLoading(true) alert('do pb stuff') // const signInResult = await signIn('email', { // email: data.email.toLowerCase(), // redirect: false, // callbackUrl: searchParams?.get('from') || '/dashboard', // }) setIsLoading(false) if (!signInResult?.ok) { alert('Your sign in request failed. Please try again.') // return toast({ // title: 'Something went wrong.', // description: 'Your sign in request failed. Please try again.', // variant: 'destructive', // }) } // return toast({ // title: 'Check your email', // description: 'We sent you a login link. Be sure to check your spam too.', // }) } return (
{errors?.email &&

{errors.email.message}

}
Or continue with
) }