19 lines
355 B
TypeScript
19 lines
355 B
TypeScript
"use server";
|
|
|
|
import createClient from "@/actions/supa";
|
|
|
|
export default async function loginServer(email: string, password: string) {
|
|
const supabase = await createClient();
|
|
|
|
const { data, error } = await supabase.auth.signInWithPassword({
|
|
email,
|
|
password,
|
|
});
|
|
|
|
if (error) {
|
|
throw new Error(error.message);
|
|
}
|
|
|
|
return data.user;
|
|
}
|