diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx index 1934777..64bfdab 100644 --- a/frontend/src/App.jsx +++ b/frontend/src/App.jsx @@ -242,7 +242,7 @@ function Sidebar({ active, setActive, user, onLogout, updateInfo, onUpdateClick ))} - {user?.role==='admin' && } + {updateInfo?.hasUpdate && ( ( ); +// ── Account-Löschung ───────────────────────────────────────────────────────── +function DeleteAccountSection({ toast, user }) { + const [pw, setPw] = useState(''); + const [busy, setBusy] = useState(false); + const { confirm, ConfirmDialog } = useConfirm(); + + const doDelete = async () => { + if (!pw) { toast('Passwort eingeben', 'error'); return; } + if (!await confirm(`Account "${user.username}" und alle Daten wirklich löschen? Das kann nicht rückgängig gemacht werden.`)) return; + setBusy(true); + try { + await api('/auth/delete-account', { method:'DELETE', body:{ password:pw } }); + localStorage.removeItem('sk_token'); + window.location.reload(); + } catch(e) { toast(e.message, 'error'); } finally { setBusy(false); } + }; + + return ( + + + setPw(e.target.value)}/> + + {busy ? '…' : '✕ Account unwiderruflich löschen'} + + + ); +} + // ── Benutzerverwaltung ──────────────────────────────────────────────────────── function UserManagement({ toast }) { const [users, setUsers] = useState([]); @@ -957,6 +988,12 @@ function AdminPanel({ toast, mobile, user }) { {busy.pw ? '…' : '✓ Passwort ändern'} + + + Löscht deinen Account und alle deine Daten unwiderruflich. + + + )} @@ -1051,7 +1088,7 @@ export default function App() { )} {active==='dashboard' && } - {active==='admin' && user?.role==='admin' && } + {active==='admin' && } {activeTool && }
+ Löscht deinen Account und alle deine Daten unwiderruflich. +