import { cookies } from 'next/headers'
import DashboardPage from './DashboardPage'

export default async function Home() {
  const cookieStore = await cookies()
  const userCookie = cookieStore.get('user')?.value

  let user = null
  if (userCookie) {
    try {
      user = JSON.parse(userCookie)
    } catch {
      // ignore
    }
  }

  return <DashboardPage user={user} />
}
