import { signIn } from "@/auth"
import { pageNames } from "@/constants/myPages"

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

export default async function Page({ params }: Params<LangParams>) {
  async function login() {
    "use server"
    await signIn("curity", {
      redirectTo: `/${params.lang}/${pageNames[params.lang]}`,
    })
  }

  return (
    <main>
      <form action={login}>
        <button type="submit">Sign In</button>
      </form>
    </main>
  )
}
