16 lines
416 B
TypeScript
16 lines
416 B
TypeScript
|
|
import { redirect } from "next/navigation"
|
||
|
|
import { getServerSession } from "next-auth"
|
||
|
|
import { authOptions } from "@/lib/auth/config"
|
||
|
|
|
||
|
|
export default async function Home() {
|
||
|
|
const session = await getServerSession(authOptions)
|
||
|
|
|
||
|
|
// Se estiver autenticado, redireciona para dashboard
|
||
|
|
if (session) {
|
||
|
|
redirect("/dashboard")
|
||
|
|
}
|
||
|
|
|
||
|
|
// Se não estiver autenticado, redireciona para login
|
||
|
|
redirect("/login")
|
||
|
|
}
|