// @ts-nocheck import React, { useMemo } from 'react'; import intl from 'react-intl-universal'; import { Formik } from 'formik'; import { Intent, Position } from '@blueprintjs/core'; import { Link, useParams, useHistory } from 'react-router-dom'; import { AppToaster, FormattedMessage as T } from '@/components'; import { useAuthResetPassword } from '@/hooks/query'; import AuthInsider from '@/containers/Authentication/AuthInsider'; import ResetPasswordForm from './ResetPasswordForm'; import { ResetPasswordSchema } from './utils'; /** * Reset password page. */ export default function ResetPassword() { const { token } = useParams(); const history = useHistory(); // Authentication reset password. const { mutateAsync: authResetPasswordMutate } = useAuthResetPassword(); // Initial values of the form. const initialValues = useMemo( () => ({ password: '', confirm_password: '', }), [], ); // Handle the form submitting. const handleSubmit = (values, { setSubmitting }) => { authResetPasswordMutate([token, values]) .then((response) => { AppToaster.show({ message: intl.get('password_successfully_updated'), intent: Intent.DANGER, position: Position.BOTTOM, }); history.push('/auth/login'); setSubmitting(false); }) .catch( ({ response: { data: { errors }, }, }) => { if (errors.find((e) => e.type === 'TOKEN_INVALID')) { AppToaster.show({ message: intl.get('an_unexpected_error_occurred'), intent: Intent.DANGER, position: Position.BOTTOM, }); history.push('/auth/login'); } setSubmitting(false); }, ); }; return (

{' '}
); }