fix: Bearer-Token bei addDbObjectWord, deleteDbObjectWord, addDbPictureWord, deleteDbPictureWord, getDesignOptions

Alle fehlenden 'Bearer '-Prefixe ergänzt. Ohne Bearer lehnt Directus die
Requests stillschweigend ab → Wörter wurden nie gespeichert → leer in DB
→ keine Anzeige in GenerateIt → keine Chips im Pair-Form.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-10 20:41:30 +02:00
parent 22e6b0a5a5
commit 5a7777f555

View File

@@ -332,7 +332,7 @@ import type { DbPicture, DbObject, DbWord, DbPair } from './types'
export async function getDesignOptions(token: string): Promise<{ text: string; value: string; color?: string }[]> {
const res = await fetch('/api/directus/db-pictures/design-options', {
headers: { Authorization: token },
headers: { Authorization: `Bearer ${token}` },
})
const data = await res.json()
return data.choices || []
@@ -483,7 +483,7 @@ export async function addDbObjectWord(
) {
const res = await fetch(`/api/directus/db-objects/${objectId}/words`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: token },
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
body: JSON.stringify(word),
})
return res.json()
@@ -497,7 +497,7 @@ export async function deleteDbObjectWord(
) {
const res = await fetch(`/api/directus/db-objects/${objectId}/words/${junctionId}`, {
method: 'DELETE',
headers: { Authorization: token },
headers: { Authorization: `Bearer ${token}` },
})
return res.json()
}
@@ -510,7 +510,7 @@ export async function addDbPictureWord(
) {
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words`, {
method: 'POST',
headers: { 'Content-Type': 'application/json', Authorization: token },
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
body: JSON.stringify({ words: [word] }),
})
return res.json()
@@ -524,7 +524,7 @@ export async function deleteDbPictureWord(
) {
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words/${junctionId}`, {
method: 'DELETE',
headers: { Authorization: token },
headers: { Authorization: `Bearer ${token}` },
})
return res.json()
}