28 lines
710 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"
import { Sandbox } from "@/lib/types"
2024-04-16 16:25:21 -04:00
export default async function DashboardPage() {
const user = await currentUser()
if (!user) {
redirect("/")
}
const res = await fetch(
`http://localhost:8787/api/user/sandbox?id=${user.id}`
)
const data = (await res.json()).sandbox as Sandbox[]
console.log(data)
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:07:15 -04:00
<Navbar userId={user.id} />
<Dashboard sandboxes={data} />
2024-04-16 16:25:21 -04:00
</div>
)
}