Fixed unsafe warning

This commit is contained in:
2025-12-23 17:21:01 +01:00
parent cd9612500c
commit 7ee8a14dfa
+8 -6
View File
@@ -2,13 +2,15 @@
import createClient from "@/actions/supa"; import createClient from "@/actions/supa";
export default async function getSession() { export default async function getSessionUserId() {
const supabase = await createClient(); const supabase = await createClient();
const { error, data } = await supabase.auth.getSession(); const { data, error } = await supabase.auth.getUser();
if (error) { if (error) throw error;
throw error;
}
return data.session?.user.id; const user = data.user;
if (!user) return null;
return user.id;
} }