Database
This commit is contained in:
@@ -14,12 +14,28 @@ export default function AdminLogin() {
|
||||
setLoading(true);
|
||||
setError('');
|
||||
|
||||
// Basit auth - production'da backend ile yapılmalı
|
||||
if (credentials.username === 'admin' && credentials.password === 'A2Metro2025!') {
|
||||
localStorage.setItem('admin_token', 'authenticated');
|
||||
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');
|
||||
} else {
|
||||
setError('Kullanıcı adı veya şifre hatalı');
|
||||
} catch (error) {
|
||||
console.error('Login error:', error);
|
||||
setError('Bir hata oluştu. Lütfen tekrar deneyin.');
|
||||
setLoading(false);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user