This commit is contained in:
22
public/ts/components/admin/index.ts
Normal file
22
public/ts/components/admin/index.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { api } from '../../services/api.js';
|
||||
import { showToast } from '../../ui/toast.js';
|
||||
|
||||
export async function initAdminSection(guildId: string) {
|
||||
const section = document.getElementById('section-admin');
|
||||
if (!section) return;
|
||||
section.innerHTML = '<p class="muted">Lade Admin-Daten...</p>';
|
||||
try {
|
||||
const data: any = await api.settings(guildId);
|
||||
section.innerHTML = `
|
||||
<h2 class="section-title">Admin</h2>
|
||||
<div class="card">
|
||||
<p class="muted">Rohdaten (nur Admin):</p>
|
||||
<pre style="white-space:pre-wrap;max-height:320px;overflow:auto;">${JSON.stringify(data, null, 2)}</pre>
|
||||
</div>
|
||||
`;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
section.innerHTML = '<div class="empty-state">Admin-Daten konnten nicht geladen werden.</div>';
|
||||
showToast('Fehler beim Laden der Admin-Daten', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user