import { getArticleGroupList } from "@/actions/article-group"
import { Page } from "@/components/page"
import ArticleEditor from "./article-editor"

export default async function ArticleEditPage({
  params,
}: {
  params: Promise<{ id: string }>
}) {
  const { id } = await params
  const groupsResp = await getArticleGroupList()
  console.log(groupsResp, "groupsResp")

  const groups = groupsResp.success ? groupsResp.data : []
  console.log(groups, "groups")

  return (
    <Page>
      <ArticleEditor articleId={id} groups={groups} />
    </Page>
  )
}
