fix: viewport metadata (Next.js 15), lazy auth client init (location SSR error), force-dynamic dashboard

This commit is contained in:
Renato
2026-07-20 18:14:06 +02:00
parent e69b18abaa
commit b15e72837f
7 changed files with 52 additions and 21 deletions
+12 -7
View File
@@ -1,16 +1,21 @@
"use client"
import { useEffect } from "react"
import { useRouter } from "next/navigation"
import { authClient } from "@/lib/auth-client"
import { getAuth } from "@/lib/auth-client"
export default function ParentDashboard() {
const { data: session } = authClient.useSession()
const auth = getAuth()
const { data: session } = auth?.useSession() ?? { data: null }
const router = useRouter()
if (!session) {
router.push("/parent/auth/login")
return null
}
useEffect(() => {
if (session === null) {
router.push("/parent/auth/login")
}
}, [session, router])
if (!session) return null
return (
<div className="min-h-dvh p-6">
@@ -22,7 +27,7 @@ export default function ParentDashboard() {
</p>
</div>
<button
onClick={() => authClient.signOut()}
onClick={() => auth?.signOut()}
className="text-sm text-muted-foreground underline"
>
Cerrar sesión