'use client'; import Link from 'next/link'; import { useState } from 'react'; import { api } from '@/lib/api'; export default function ForgotPasswordPage() { const [sentTo, setSentTo] = useState(null); const [error, setError] = useState(null); const [busy, setBusy] = useState(false); const onSubmit = async (e: React.FormEvent) => { e.preventDefault(); const email = String(new FormData(e.currentTarget).get('email') ?? '').trim(); setBusy(true); setError(null); try { await api('/auth/forgot-password', { body: { email } }); setSentTo(email); } catch (err) { setError((err as Error).message); } setBusy(false); }; if (sentTo) { return (

Check your email

If {sentTo} has a musicshare account, we've sent it a link to choose a new password. It expires in an hour.

Nothing there? Check your spam folder, or try again in a minute.

Back to log in
); } return (

Reset your password

Enter the email you signed up with and we'll send you a link to choose a new password.

{error &&

{error}

}

Remembered it? Log in

); }