This commit is contained in:
23
public/ts/components/modules/statuspage.ts
Normal file
23
public/ts/components/modules/statuspage.ts
Normal file
@@ -0,0 +1,23 @@
|
||||
import { api } from '../../services/api.js';
|
||||
import { showToast } from '../../ui/toast.js';
|
||||
|
||||
export async function renderStatuspageModule(guildId: string) {
|
||||
const container = document.getElementById('module-statuspage');
|
||||
if (!container) return;
|
||||
container.innerHTML = '<p class="muted">Lade Statuspage...</p>';
|
||||
try {
|
||||
const data: any = await api.statuspage(guildId);
|
||||
const cfg = data?.config || data || {};
|
||||
const services = cfg.services || [];
|
||||
container.innerHTML = `
|
||||
<h3 class="label">Statuspage</h3>
|
||||
<p class="muted">Channel: ${cfg.channelId || '-'}</p>
|
||||
<p class="muted">Intervall: ${cfg.interval || '-'}m</p>
|
||||
<p class="muted">Services: ${services.length}</p>
|
||||
`;
|
||||
} catch (err) {
|
||||
console.error(err);
|
||||
container.innerHTML = '<div class="empty-state">Statuspage konnte nicht geladen werden.</div>';
|
||||
showToast('Fehler beim Laden der Statuspage', true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user