'use client'; import React, { useState, useEffect } from 'react'; import { Zap, ShieldCheck, Save, RefreshCcw, Wallet, Settings, Server, Key, AlertCircle } from 'lucide-react'; export default function AdminSettingsPage() { const [settings, setSettings] = useState({ sol_platform_address: '', evm_platform_address: '', default_fee_percent: '1.0' }); const [isLoading, setIsLoading] = useState(true); const [isSaving, setIsSaving] = useState(false); const [message, setMessage] = useState({ type: '', text: '' }); useEffect(() => { fetchSettings(); }, []); const fetchSettings = async () => { setIsLoading(true); try { const res = await fetch('/api/admin/settings'); const data = await res.json(); if (data.error) throw new Error(data.error); setSettings({ sol_platform_address: data.sol_platform_address || '', evm_platform_address: data.evm_platform_address || '', default_fee_percent: data.default_fee_percent || '1.0' }); } catch (err: any) { setMessage({ type: 'error', text: 'Ayarlar yüklenemedi: ' + err.message }); } finally { setIsLoading(false); } }; const handleSave = async (e: React.FormEvent) => { e.preventDefault(); setIsSaving(true); setMessage({ type: '', text: '' }); try { const res = await fetch('/api/admin/settings', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(settings) }); const data = await res.json(); if (data.error) throw new Error(data.error); setMessage({ type: 'success', text: 'Ayarlar başarıyla güncellendi.' }); } catch (err: any) { setMessage({ type: 'error', text: 'Kaydetme hatası: ' + err.message }); } finally { setIsSaving(false); } }; return (
Sistem Genel Yapılandırması