import { I18nProvider } from "@/i18n";
import LoginPage from "@/components/LoginPage/LoginPage";
import LoginRedirectIfAuthenticated from "@/components/LoginPage/LoginRedirectIfAuthenticated";

/**
 * Redirect when already authenticated is done in LoginRedirectIfAuthenticated
 * (client-side with useSearchParams) so it works in production where server
 * searchParams can be undefined after build.
 */
const Login: React.FC = () => {
  return (
    <LoginRedirectIfAuthenticated>
      <I18nProvider namespaces={["login"]}>
        <LoginPage />
      </I18nProvider>
    </LoginRedirectIfAuthenticated>
  );
};

export default Login;
