"use client" import { useState } from "react" import { useRouter } from "next/navigation" import Link from "next/link" import { useAuth } from "@/hooks/use-auth" 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" export default function LoginPage() { const router = useRouter() const { login } = useAuth() const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [error, setError] = useState("") const [loading, setLoading] = useState(false) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() setError("") setLoading(true) try { await login(email, password) router.push("/") } catch { setError("Invalid email or password") } finally { setLoading(false) } } return ( Sign in Enter your email to sign in to K-Photos
{error && (

{error}

)}
setEmail(e.target.value)} />
setPassword(e.target.value)} />

Don't have an account?{" "} Register

) }