import Dashboard from "@/components/dashboard" import Navbar from "@/components/dashboard/navbar" import { User } from "@/lib/types" import { currentUser } from "@clerk/nextjs" import { redirect } from "next/navigation" export default async function DashboardPage() { const user = await currentUser() if (!user) { redirect("/") } const userRes = await fetch( `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/user?id=${user.id}`, { headers: { Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, }, } ) const userData = (await userRes.json()) as User const sharedRes = await fetch( `${process.env.NEXT_PUBLIC_DATABASE_WORKER_URL}/api/sandbox/share?id=${user.id}`, { headers: { Authorization: `${process.env.NEXT_PUBLIC_WORKERS_KEY}`, }, } ) const shared = (await sharedRes.json()) as { id: string name: string type: "react" | "node" author: string sharedOn: Date authorAvatarUrl: string }[] return (
) }