import React, { useState } from 'react' import toast, { Toaster } from 'react-hot-toast'; import {wantNewPw} from '../services/PhpApi' import './InputForm.css'; function WantNewPw() { const [email, setEmail] = useState(''); const onChangeInput = (e: React.FormEvent ) => { // console.log(e.currentTarget.value); setEmail(e.currentTarget.value); } const submitForm = async (e: React.FormEvent) => { e.preventDefault(); // console.log(email); // console.log((e.currentTarget.elements[0] as HTMLInputElement).value); // if((e.currentTarget.elements[0] as HTMLInputElement).value.trim() === '') // { // toast.error('Bitte Feld ausfüllen!'); // return; // } const data = await wantNewPw({email: email}); if(data.success) { toast.success('Passwort angefordert! Bitte Postfach ' + email + ' checken!'); //e.currentTarget.reset(); } else if(!data.success && data.message) { toast.error(data.message); } } return (

Neues Passwort setzen!

) } export default WantNewPw