I want to create Auth with Supabase and drizzle-orm.
Can someone please tell me how to do this?
When I run this code, data doesn't have user data.
export async function signup(formData:FormData){
const supabase=createClient()
const formUserData={
email:formData.get('email') as string,
password:formData.get('password') as string
}
const {data:{user},error}=await supabase.auth.signUp(formUserData)
console.log('signUp')
console.log(user)
if(error||!user?.id||!user){
redirect('/error')
}
const existingAccount=await getAccount(formUserData.email);
if (existingAccount!==undefined){
console.log('existingAccount')
revalidatePath('/',"layout")
redirect("/");
}
await db.insert(testAccounts).values({
email: formUserData.email,
password: formUserData.password,
userId: user.id
})
revalidatePath('/','layout')
redirect('/private')
}
export async function signup(formData:FormData){
const supabase=createClient()
const formUserData={
email:formData.get('email') as string,
password:formData.get('password') as string
}
const {data:{user},error}=await supabase.auth.signUp(formUserData)
console.log('signUp')
console.log(user)
if(error||!user?.id||!user){
redirect('/error')
}
const existingAccount=await getAccount(formUserData.email);
if (existingAccount!==undefined){
console.log('existingAccount')
revalidatePath('/',"layout")
redirect("/");
}
await db.insert(testAccounts).values({
email: formUserData.email,
password: formUserData.password,
userId: user.id
})
revalidatePath('/','layout')
redirect('/private')
}
0 Replies