import { getAdminsAdmin, deleteAdminAdmin, getCurrentAdmin } from '../../actions'; import { revalidatePath } from 'next/cache'; import { Shield, KeyRound, Trash2 } from 'lucide-react'; import AddAdminModal from './AddAdminModal'; import ChangePasswordModal from './ChangePasswordModal'; export default async function AdminsAdminPage() { const admins = await getAdminsAdmin(); const currentAdmin = await getCurrentAdmin(); async function handleDelete(formData: FormData) { 'use server'; const id = Number(formData.get('id')); const res = await deleteAdminAdmin(id); if (res.error) { // Usually we want to return feedback, but a simple redirect/refresh works console.error(res.error); } revalidatePath('/admin/users'); } return (

Yöneticiler

Sistem yöneticileri ve erişim kontrolü.

{admins.map((admin: any) => { const isSelf = admin.username === currentAdmin; return ( ); })}
ID Kullanıcı Adı Oluşturulma Tarihi İşlemler
#{admin.id}
{admin.username} {isSelf && ( Siz )}
{new Date(admin.created_at).toLocaleDateString('tr-TR', { year: 'numeric', month: 'long', day: 'numeric', hour: '2-digit', minute: '2-digit' })}
{/* Change Password */} {/* Delete Admin */} {!isSelf && (
{ if (!confirm(`${admin.username} yöneticisini silmek istediğinize emin misiniz?`)) { e.preventDefault(); } }} className="inline">
)}
); }