import { getIntl } from "@/i18n"
import { setLang } from "@/i18n/serverContext"

import styles from "./page.module.css"

import type { LangParams, LayoutArgs, StatusParams } from "@/types/params"

export default async function MiddlewareError({
  params,
}: LayoutArgs<LangParams & StatusParams>) {
  setLang(params.lang)

  const intl = await getIntl()

  return (
    <div className={styles.layout}>
      {intl.formatMessage(
        { id: "Middleware error {lang}: {status}" },
        {
          lang: params.lang,
          status: params.status,
        }
      )}
    </div>
  )
}
