Added middleware and session helper

This commit is contained in:
2025-06-26 11:52:42 +02:00
parent a26d60ea85
commit 38b3896c85
3 changed files with 38 additions and 7 deletions

14
src/lib/auth/session.ts Normal file
View File

@@ -0,0 +1,14 @@
import { headers } from "next/headers"
import { auth } from "./auth"
import { redirect } from "next/navigation"
export async function getSession() {
const session = await auth.api.getSession({
headers: await headers()
})
const redirectFunc = (path: string) => {
redirect(path)
}
return { session, redirect: redirectFunc }
}