'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; import { login } from './api'; import { Button } from '@/components/ui/button'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import Link from 'next/link'; import { Zap, Mail, Lock, ArrowRight, Loader2 } from 'lucide-react'; export function LoginForm() { const router = useRouter(); const [loading, setLoading] = useState(false); const [error, setError] = useState(''); const handleSubmit = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); const formData = new FormData(e.currentTarget); const data = Object.fromEntries(formData.entries()); try { await login(data); router.push('/dashboard'); } catch (err: any) { console.error(err); setError(err.response?.data?.message || 'Login failed. Please check your credentials.'); } finally { setLoading(false); } }; return (
{/* Animated Background Elements */}
Welcome Back Sign in to continue to wexts
{error && (
⚠️ {error}
)}
Forgot password?
Don't have an account?{' '} Create account

© 2025 wexts Inc. All rights reserved.

); }