fix db relations + display sandboxes on dash

This commit is contained in:
Ishaan Dey
2024-04-18 00:13:40 -04:00
parent 14d76c605e
commit 19c2992824
13 changed files with 458 additions and 36 deletions

View File

@ -2,6 +2,7 @@ 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"
export default async function DashboardPage() {
const user = await currentUser()
@ -10,10 +11,17 @@ export default async function DashboardPage() {
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)
return (
<div className="w-screen h-screen flex flex-col overflow-hidden overscroll-none">
<Navbar />
<Dashboard />
<Dashboard sandboxes={data} />
</div>
)
}