import { useState } from "react"; import { getApiBase } from "../api"; function ForgotPassword({ onBack }) { const [email, setEmail] = useState(""); const [message, setMessage] = useState(""); const [error, setError] = useState(""); const [loading, setLoading] = useState(false); const handleSubmit = async (e) => { e.preventDefault(); setError(""); setMessage(""); setLoading(true); try { const response = await fetch(`${getApiBase()}/forgot-password`, { method: "POST", headers: { "Content-Type": "application/json", }, body: JSON.stringify({ email }), }); const data = await response.json(); if (response.ok) { setMessage(data.message); setEmail(""); } else { setError(data.detail || "שגיאה בשליחת הבקשה"); } } catch (err) { setError("שגיאה בשליחת הבקשה"); } finally { setLoading(false); } }; return (
הזן את כתובת המייל שלך ונשלח לך קישור לאיפוס הסיסמה
נזכרת בסיסמה?{" "}