ResetPassword.tsx 781 B

1234567891011121314151617181920212223242526272829
  1. import { useMutation } from '@apollo/react-hooks'
  2. import { USER_RESET_PASSWORD } from './graphql'
  3. import { useFormHandler, TextInput } from '../form/forms'
  4. import { FormEvent } from 'react'
  5. const initialValues = {
  6. password: '',
  7. passwordAgain: ''
  8. }
  9. const ResetPassword = () => {
  10. const [resetPassword, { loading, error }] = useMutation(USER_RESET_PASSWORD)
  11. const { inputProps } = useFormHandler(initialValues)
  12. return (
  13. <form onSubmit={async (event: FormEvent) => {
  14. event.preventDefault()
  15. }}>
  16. <TextInput label='Password' {...inputProps('password')} />
  17. <TextInput label='Repeat password' {...inputProps('passwordAgain')} />
  18. <button type='submit' disabled={loading}>Reset Password</button>
  19. </form>
  20. )
  21. }
  22. export default ResetPassword