Orphan-Junction-Cleanup + Refresh-Button für Fragen/Wörter

- Backend: DELETE question/word räumt alle Junction-Zeilen mit auf
- Backend: /purge-orphans bereinigt verwaiste Junctions per Objekt
- Frontend: reloadQW ruft purgeOrphans vor dem Neu-Laden auf
- Frontend: ↺-Button in Wörter- und Fragen-Sidebar

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-26 20:38:26 +02:00
parent c2a2b0e6f7
commit 8f01c0396e
3 changed files with 64 additions and 4 deletions

View File

@@ -281,3 +281,13 @@ export async function deleteWord(wId: string, token: string): Promise<void> {
})
if (!res.ok) throw new Error('Fehler beim Löschen des Worts')
}
export async function purgeOrphans(objId: string, token: string): Promise<{ orphans_removed: number }> {
const res = await fetch(`/api/object/${encodeURIComponent(objId)}/purge-orphans`, {
method: 'POST',
headers: { Authorization: `Bearer ${token}` },
})
const data = await res.json()
if (!res.ok) throw new Error('Fehler beim Bereinigen')
return data
}