From 5a7777f5550fa1672cd2277dd0f0208895bb475d Mon Sep 17 00:00:00 2001 From: admin Date: Sun, 10 May 2026 20:41:30 +0200 Subject: [PATCH] fix: Bearer-Token bei addDbObjectWord, deleteDbObjectWord, addDbPictureWord, deleteDbPictureWord, getDesignOptions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- frontend/src/api.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/src/api.ts b/frontend/src/api.ts index f6128bd..13a3b70 100644 --- a/frontend/src/api.ts +++ b/frontend/src/api.ts @@ -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() }