import { NextPage } from 'next' import Link from 'next/link' import useTranslation from 'next-translate/useTranslation' import axios from 'axios' import { AuthenticationForm } from 'components/Authentication' import { Head } from 'components/Head' import { Header } from 'components/Header' import { Main } from 'components/design/Main' import { Footer, FooterProps } from 'components/Footer' import { Input } from 'components/design/Input' import { Button } from 'components/design/Button' import { FormState } from 'components/design/FormState' import { authenticationFromServerSide } from 'tools/authentication' import { ScrollableBody } from 'components/ScrollableBody' import { userSchema } from 'models/User' import { api } from 'tools/api' import { HandleSubmitCallback, useForm } from 'hooks/useForm' const ForgotPassword: NextPage = (props) => { const { t } = useTranslation() const { version } = props const { fetchState, message, errors, getErrorTranslation, handleSubmit } = useForm({ validateSchemaObject: { email: userSchema.email } }) const onSubmit: HandleSubmitCallback = async (formData) => { try { await api.post( `/users/reset-password?redirectURI=${window.location.origin}/authentication/reset-password`, formData ) return { type: 'success', value: 'authentication:success-forgot-password' } } catch (error) { if (axios.isAxiosError(error) && error.response?.status === 400) { return { type: 'error', value: 'errors:email' } } return { type: 'error', value: 'errors:server-error' } } } return (

{t('authentication:already-know-password')}