Fixed unsafe warning
This commit is contained in:
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user