import { useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { Disc3, Mail, Lock, Loader2 } from 'lucide-react' import { useAuth } from '../lib/auth' import { login as apiLogin } from '../lib/api' export default function Login() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const [error, setError] = useState('') const [loading, setLoading] = useState(false) const { login } = useAuth() const navigate = useNavigate() const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError('') setLoading(true) try { const response = await apiLogin(email, password) await login(response.access_token) navigate('/dashboard') } catch (err: any) { setError(err.response?.data?.detail || 'Invalid email or password') } finally { setLoading(false) } } return (
{/* Header */}
Vynl
{/* Form */}

Welcome back

Sign in to your Vynl account

{error && (
{error}
)}
setEmail(e.target.value)} placeholder="you@example.com" required className="w-full pl-11 pr-4 py-3 bg-cream/50 border border-purple-100 rounded-xl text-charcoal placeholder:text-charcoal-muted/40 focus:outline-none focus:ring-2 focus:ring-purple/30 focus:border-purple transition-colors text-sm box-border" />
setPassword(e.target.value)} placeholder="Enter your password" required className="w-full pl-11 pr-4 py-3 bg-cream/50 border border-purple-100 rounded-xl text-charcoal placeholder:text-charcoal-muted/40 focus:outline-none focus:ring-2 focus:ring-purple/30 focus:border-purple transition-colors text-sm box-border" />

Don't have an account?{' '} Sign up

) }