import * as React from 'react'; import { Link } from 'react-router-dom'; import requestPasswordResetEmail from '@/api/auth/requestPasswordResetEmail'; import { httpErrorToHuman } from '@/api/http'; import LoginFormContainer from '@/components/auth/LoginFormContainer'; import { Actions, useStoreActions } from 'easy-peasy'; import { ApplicationState } from '@/state/types'; import FlashMessageRender from '@/components/FlashMessageRender'; export default () => { const [ isSubmitting, setSubmitting ] = React.useState(false); const [ email, setEmail ] = React.useState(''); const { clearFlashes, addFlash } = useStoreActions((actions: Actions) => actions.flashes); const handleFieldUpdate = (e: React.ChangeEvent) => setEmail(e.target.value); const handleSubmission = (e: React.FormEvent) => { e.preventDefault(); setSubmitting(true); clearFlashes(); requestPasswordResetEmail(email) .then(response => { setEmail(''); addFlash({ type: 'success', title: 'Success', message: response }); }) .catch(error => { console.error(error); addFlash({ type: 'error', title: 'Error', message: httpErrorToHuman(error) }); }) .then(() => setSubmitting(false)); }; return (

Request Password Reset

Enter your account email address to receive instructions on resetting your password.

Return to Login
); };