24 lines
693 B
TypeScript
Raw Normal View History

2024-04-16 16:25:21 -04:00
import { UserButton, currentUser } from "@clerk/nextjs"
import { redirect } from "next/navigation"
import Dashboard from "@/components/dashboard"
import Navbar from "@/components/dashboard/navbar"
2024-04-18 15:25:20 -04:00
import { Sandbox, User } from "@/lib/types"
2024-04-16 16:25:21 -04:00
export default async function DashboardPage() {
const user = await currentUser()
if (!user) {
redirect("/")
}
2024-04-18 15:25:20 -04:00
const userRes = await fetch(`http://localhost:8787/api/user?id=${user.id}`)
const userData = (await userRes.json()) as User
2024-04-16 16:25:21 -04:00
return (
<div className="w-screen h-screen flex flex-col overflow-hidden overscroll-none">
2024-04-18 15:25:20 -04:00
<Navbar userData={userData} />
<Dashboard sandboxes={userData.sandbox} />
2024-04-16 16:25:21 -04:00
</div>
)
}