'use client'; import { useState } from 'react'; import { useRouter } from 'next/navigation'; export default function AdminLogin() { const router = useRouter(); const [credentials, setCredentials] = useState({ username: '', password: '' }); const [error, setError] = useState(''); const [loading, setLoading] = useState(false); const handleLogin = async (e: React.FormEvent) => { e.preventDefault(); setLoading(true); setError(''); try { const response = await fetch('/api/auth/login', { method: 'POST', headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(credentials), }); const data = await response.json(); if (!response.ok) { setError(data.error || 'Giriş başarısız'); setLoading(false); return; } // Başarılı giriş router.push('/yonetim-paneli-a2m-secure/dashboard'); } catch (error) { console.error('Login error:', error); setError('Bir hata oluştu. Lütfen tekrar deneyin.'); setLoading(false); } }; return (
{/* Logo ve Başlık */}

Yönetim Paneli

A2 Metro Hattı İnşaat Projesi

{/* Login Form */}
{error && (
{error}
)}
setCredentials({ ...credentials, username: e.target.value })} className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#00B4D8] focus:border-transparent outline-none transition-all text-gray-900" placeholder="Kullanıcı adınızı girin" required />
setCredentials({ ...credentials, password: e.target.value })} className="w-full px-4 py-3 border border-gray-300 rounded-lg focus:ring-2 focus:ring-[#00B4D8] focus:border-transparent outline-none transition-all text-gray-900" placeholder="Şifrenizi girin" required />
{/* Footer */}

© 2025 Ankara Büyükşehir Belediyesi

); }