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

View File

@@ -1,18 +1,15 @@
import { OAuthSignInButton } from "@/components/auth/signin-button"
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card"
import { auth } from "@/lib/auth/auth"
import { getSession } from "@/lib/auth/session"
import { LogIn } from "lucide-react"
import { headers } from "next/headers"
import { redirect } from "next/navigation"
export default async function SignInPage() {
const session = await auth.api.getSession({
headers: await headers()
})
const { session, redirect } = await getSession()
if (session) {
redirect("/")
redirect("/dashboard")
}
return (
<div className="min-h-screen flex items-center justify-center bg-gradient-to-br from-slate-50 to-slate-100 dark:from-slate-900 dark:to-slate-800 p-4">
<Card className="w-full max-w-md shadow-xl">