feat: object words in left sidebar + suggestions in pair form

- Backend: GET /api/directus/db-objects/<id>/words via db_objects_db_words
- GenerateIt: load objectWords on object select, show as chips in left sidebar
- PairForm: show object words as clickable suggestion chips above word input
  (click to add, greyed out if already added)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 12:07:42 +02:00
parent 8bcb3b9168
commit 2e6cf094cb
3 changed files with 110 additions and 13 deletions

View File

@@ -454,6 +454,15 @@ export async function createDbPair(
return data
}
export async function getDbObjectWords(objectId: string, token: string): Promise<DbWord[]> {
const res = await fetch(`/api/directus/db-objects/${objectId}/words`, {
headers: { Authorization: `Bearer ${token}` },
})
const data = await res.json()
if (!res.ok) throw new Error('Fehler beim Laden der Objekt-Wörter')
return data.data as DbWord[]
}
export async function updateDbPair(
pairId: string,
payload: { level?: number; question_de?: string; statement_de?: string },