fix: viewport metadata (Next.js 15), lazy auth client init (location SSR error), force-dynamic dashboard
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user