import { serverClient } from "@/lib/trpc/server"

import Form from "@/components/Forms/Edit/Profile"
import { setLang } from "@/i18n/serverContext"

import { LangParams, PageArgs } from "@/types/params"

export default async function EditProfileSlot({
  params,
}: PageArgs<LangParams>) {
  setLang(params.lang)

  const user = await serverClient().user.get()
  if (!user || "error" in user) {
    return null
  }
  return <Form user={user} />
}
