import { getProfile } from "@/lib/trpc/memoizedRequests"

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 getProfile()
  if (!user || "error" in user) {
    return null
  }
  return <Form user={user} />
}
