feat: implement password reset API endpoint and wire up form
- Add POST /api/auth/password-reset endpoint to validate email and process reset requests - Wire up password reset form to call API instead of stubbing success - This enables proper password reset flow for Issue #10
This commit is contained in:
@@ -15,6 +15,22 @@ export default function PasswordResetPage() {
|
||||
setError("")
|
||||
|
||||
try {
|
||||
const response = await fetch("/api/auth/password-reset", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ email }),
|
||||
})
|
||||
|
||||
const data = await response.json()
|
||||
|
||||
if (!response.ok) {
|
||||
setError(data.error || "Failed to send reset link")
|
||||
setLoading(false)
|
||||
return
|
||||
}
|
||||
|
||||
setSent(true)
|
||||
} catch (err) {
|
||||
console.error("Password reset error:", err)
|
||||
|
||||
Reference in New Issue
Block a user