import { useRequestResetMutation } from '../../gql'
import { useFormHandler, TextInput } from '../../form'

const initialValues = {
  email: ''
}

const RequestPassword = () => {

  const [requestPassword, { loading, error }] = useRequestResetMutation()
  const { inputProps } = useFormHandler(initialValues)

  return (
    <form onSubmit={async (event: React.SyntheticEvent) => {
      event.preventDefault()
    }}>
      <TextInput label='Email' {...inputProps('email')} />
      <button type='submit' disabled={loading}>Request new password</button>
    </form>
  )
}

export default RequestPassword
