import { Field, Form, Formik } from "formik"; import { useEffect, useRef, useState } from "react"; import Alert from "react-bootstrap/Alert"; import { Button, LocalePicker, Page, ThemeSwitcher } from "src/components"; import { useAuthState } from "src/context"; import { useHealth } from "src/hooks"; import { intl, T } from "src/locale"; import { validateEmail, validateString } from "src/modules/Validations"; import styles from "./index.module.css"; export default function Login() { const emailRef = useRef(null); const [formErr, setFormErr] = useState(""); const { login } = useAuthState(); const onSubmit = async (values: any, { setSubmitting }: any) => { setFormErr(""); try { await login(values.email, values.password); } catch (err) { if (err instanceof Error) { setFormErr(err.message); } } setSubmitting(false); }; useEffect(() => { // @ts-expect-error ts-migrate(2531) FIXME: Object is possibly 'null'. emailRef.current.focus(); }, []); const health = useHealth(); const getVersion = () => { if (!health.data) { return ""; } const v = health.data.version; return `v${v.major}.${v.minor}.${v.revision}`; }; return (
Nginx Proxy Manager

{formErr !== "" && {formErr}} {({ isSubmitting }) => (
{({ field, form }: any) => ( )}
{({ field, form }: any) => ( <> )}
)}
{getVersion()}
); }