init
This commit is contained in:
8
lib/session.ts
Normal file
8
lib/session.ts
Normal file
@@ -0,0 +1,8 @@
|
||||
import { auth } from "@/auth";
|
||||
|
||||
export async function getCurrentUserId(): Promise<string> {
|
||||
const session = await auth();
|
||||
const id = session?.user?.id;
|
||||
if (!id) throw new Error("Użytkownik nie jest zalogowany.");
|
||||
return id;
|
||||
}
|
||||
Reference in New Issue
Block a user