mirror of
https://github.com/LukeHagar/better-auth.git
synced 2025-12-07 12:27:44 +00:00
28 lines
868 B
TypeScript
28 lines
868 B
TypeScript
import { auth } from "@/lib/auth"
|
|
import { headers } from "next/headers"
|
|
import { redirect } from "next/navigation"
|
|
import UserCard from "./user-card"
|
|
import { OrganizationCard } from "./organization-card"
|
|
|
|
|
|
export default async function DashboardPage() {
|
|
const [session, activeSessions] = await Promise.all([
|
|
await auth.api.getSession({
|
|
headers: headers()
|
|
}),
|
|
await auth.api.listSessions({
|
|
headers: headers()
|
|
})
|
|
])
|
|
if (!session) {
|
|
throw redirect("/sign-in")
|
|
}
|
|
return (
|
|
<div className="w-full">
|
|
<div className="flex gap-4 flex-col">
|
|
<UserCard session={JSON.parse(JSON.stringify(session))} activeSessions={activeSessions} />
|
|
<OrganizationCard session={JSON.parse(JSON.stringify(session))} />
|
|
</div>
|
|
</div>
|
|
)
|
|
} |