Files
axiom/src/actions/get-session.ts
T
2025-12-23 17:21:01 +01:00

17 lines
310 B
TypeScript

"use server";
import createClient from "@/actions/supa";
export default async function getSessionUserId() {
const supabase = await createClient();
const { data, error } = await supabase.auth.getUser();
if (error) throw error;
const user = data.user;
if (!user) return null;
return user.id;
}