import { useState } from 'react' import { Link, useNavigate } from 'react-router-dom' import { useAuthStore } from '@/store/authStore' import { Button } from '@/components/ui/button' import { Input } from '@/components/ui/input' import { Label } from '@/components/ui/label' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Alert, AlertDescription } from '@/components/ui/alert' import LoadingSpinner from '@/components/LoadingSpinner' import { MessageCircle } from 'lucide-react' export default function LoginPage() { const [email, setEmail] = useState('') const [password, setPassword] = useState('') const { login, loading, error, clearError } = useAuthStore() const navigate = useNavigate() const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() clearError() try { await login(email, password) navigate('/chat') } catch (error) { // Error is handled by the store } } return (
Welcome Back Sign in to your ChatApp account
{error && ( {error} )}
setEmail(e.target.value)} required disabled={loading} />
setPassword(e.target.value)} required disabled={loading} />

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

) }