import { useState } from 'preact/hooks'; import { httpPost } from '../../lib/http'; export function ForgotPasswordForm() { const [email, setEmail] = useState(''); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(''); const [success, setSuccess] = useState(''); const handleSubmit = async (e: Event) => { e.preventDefault(); setIsLoading(true); setError(''); const { response, error } = await httpPost( `${import.meta.env.PUBLIC_API_URL}/v1-forgot-password`, { email, } ); setIsLoading(false); if (error) { setError(error.message); } else { setEmail(''); setSuccess('Check your email for a link to reset your password.'); } }; return (
); }