import { useState, type FormEvent } from 'react'; // Używamy type FormEvent import { Cat, ArrowLeft, Loader2, AlertCircle } from 'lucide-react'; import { useAuth } from '../hooks/useAuth'; interface LoginViewProps { onBack: () => void; onSuccess: () => void; } export const LoginView = ({ onBack, onSuccess }: LoginViewProps) => { const [isSignUp, setIsSignUp] = useState(false); const [name, setName] = useState(''); const [password, setPassword] = useState(''); const { signIn, signUp, loading, error, isAuthenticated } = useAuth(); const handleSubmit = async (e: FormEvent) => { // Zmieniono na FormEvent e.preventDefault(); const result = isSignUp ? await signUp(name, password) : await signIn(name, password); if (result) { onSuccess(); } }; return (

{isSignUp ? 'Create Kitty Account' : 'Kitty Login'}

{error && (
{error}
)} {isAuthenticated && (
Success! Meow! 🐾
)}
setName(e.target.value)} required /> setPassword(e.target.value)} required />
); };