diff --git a/app/MainClient.tsx b/app/MainClient.tsx index d3069f1..84cf116 100644 --- a/app/MainClient.tsx +++ b/app/MainClient.tsx @@ -21,6 +21,7 @@ export default function MainClient({ kuerzel, beoId, beoName, role }: Props) { const [activeTab, setActiveTab] = useState<'eingabe' | 'liste' | 'statistik' | 'fahrkosten'>('eingabe'); const [refreshKey, setRefreshKey] = useState(0); const [editEntry, setEditEntry] = useState(null); + const [backupState, setBackupState] = useState<'idle' | 'running' | 'ok' | 'error'>('idle'); const grafikSrc = '/api/statistik/grafik'; @@ -47,6 +48,17 @@ export default function MainClient({ kuerzel, beoId, beoName, role }: Props) { window.location.href = '/login'; } + async function handleBackup() { + setBackupState('running'); + try { + const r = await fetch('/api/backup', { method: 'POST' }); + setBackupState(r.ok ? 'ok' : 'error'); + } catch { + setBackupState('error'); + } + setTimeout(() => setBackupState('idle'), 4000); + } + return (
@@ -59,12 +71,25 @@ export default function MainClient({ kuerzel, beoId, beoName, role }: Props) {
{role?.includes('admin') && ( - - Admin - + <> + + + Admin + + )}