'use client'
import { useRouter } from "next/navigation"
import { useEffect } from "react"
import { useAsyncEffect } from 'use-async-effect'
import { useShallow } from 'zustand/react/shallow'
import { UserResponse } from './client/response'
import { useCurrentAuthenticatedUserStore, UserActions } from './providers'

export default function Home() {
  const authenticatedUserStore: UserResponse & UserActions = useCurrentAuthenticatedUserStore(useShallow((state) => ({
  	...state
  })))
  useAsyncEffect(async () => {
	if(authenticatedUserStore.Id === -1) {
		await authenticatedUserStore.sync()
	}
  })
  const router = useRouter()

  useEffect(() => {
    router.push('/orders/0/0')
  }, [router])

  return (
    <div className="flex min-h-screen items-center justify-center bg-zinc-50 font-sans dark:bg-black">
      <main className="flex min-h-screen w-full max-w-3xl flex-col items-center justify-between py-32 px-16 bg-white dark:bg-black sm:items-start">

      </main>
    </div>
  );
}
