(e: FormEvent<HTMLFormElement>)
| 35 | const [isLoading, setIsLoading] = useState(false); |
| 36 | |
| 37 | const onSendEmail = async (e: FormEvent<HTMLFormElement>) => { |
| 38 | e.preventDefault(); |
| 39 | logEvent({ |
| 40 | event_name: AuthEventNames.SubmitForgotPassword, |
| 41 | }); |
| 42 | const { email } = formToJson<{ email: string }>(e.currentTarget); |
| 43 | setEmail(email); |
| 44 | |
| 45 | setIsLoading(true); |
| 46 | setHint(''); |
| 47 | const redirectTo = `${window.location.origin}/reset-password`; |
| 48 | const res = await betterAuthForgetPassword(email, redirectTo); |
| 49 | setIsLoading(false); |
| 50 | |
| 51 | if (res.error) { |
| 52 | setHint(res.error); |
| 53 | return; |
| 54 | } |
| 55 | |
| 56 | setEmailSent(true); |
| 57 | }; |
| 58 | |
| 59 | if (emailSent) { |
| 60 | return ( |
nothing calls this directly
no test coverage detected