"use client" import { useState } from "react" import { useRouter } from "next/navigation" import Link from "next/link" import { supabase } from "@/lib/supabase" 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 { AlertCircle, Loader2 } from "lucide-react" export default function LoginPage() { const router = useRouter() const [email, setEmail] = useState("") const [password, setPassword] = useState("") const [loading, setLoading] = useState(false) const [error, setError] = useState(null) const handleLogin = async (e: React.FormEvent) => { e.preventDefault() setLoading(true) setError(null) try { const { error } = await supabase.auth.signInWithPassword({ email, password, }) if (error) { setError(error.message) return } router.push("/") router.refresh() } catch (err: any) { setError("Bir hata oluştu. Lütfen tekrar deneyin.") } finally { setLoading(false) } } return (
Giriş Yap Hesabınıza erişmek için bilgilerinizi girin
setEmail(e.target.value)} required />
setPassword(e.target.value)} required />
{error && (
{error}
)}
Ana Sayfaya Dön
) }