import { useState } from "react" import { Button } from "@/components/ui/button" import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "@/components/ui/card" import { Input } from "@/components/ui/input" import { Label } from "@/components/ui/label" import { login } from "@/apiv1/auth.service" import { Link } from "react-router" export function LoginPage({ className }) { const [username, setUsername] = useState("") const [password, setPassword] = useState("") const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState("") const [success, setSuccess] = useState("") const handleSubmit = async (e) => { e.preventDefault() setError("") setSuccess("") setIsLoading(true) try { const result = await login(username, password) setSuccess("Login successful!") console.log("Logged in:", result) } catch (err) { setError(err.detail || "Login failed. Please check your credentials.") console.error("Login error:", err) } finally { setIsLoading(false) } } return (