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:
@@ -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 }[]> {
|
export async function getDesignOptions(token: string): Promise<{ text: string; value: string; color?: string }[]> {
|
||||||
const res = await fetch('/api/directus/db-pictures/design-options', {
|
const res = await fetch('/api/directus/db-pictures/design-options', {
|
||||||
headers: { Authorization: token },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
})
|
})
|
||||||
const data = await res.json()
|
const data = await res.json()
|
||||||
return data.choices || []
|
return data.choices || []
|
||||||
@@ -483,7 +483,7 @@ export async function addDbObjectWord(
|
|||||||
) {
|
) {
|
||||||
const res = await fetch(`/api/directus/db-objects/${objectId}/words`, {
|
const res = await fetch(`/api/directus/db-objects/${objectId}/words`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json', Authorization: token },
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
|
||||||
body: JSON.stringify(word),
|
body: JSON.stringify(word),
|
||||||
})
|
})
|
||||||
return res.json()
|
return res.json()
|
||||||
@@ -497,7 +497,7 @@ export async function deleteDbObjectWord(
|
|||||||
) {
|
) {
|
||||||
const res = await fetch(`/api/directus/db-objects/${objectId}/words/${junctionId}`, {
|
const res = await fetch(`/api/directus/db-objects/${objectId}/words/${junctionId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: { Authorization: token },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
})
|
})
|
||||||
return res.json()
|
return res.json()
|
||||||
}
|
}
|
||||||
@@ -510,7 +510,7 @@ export async function addDbPictureWord(
|
|||||||
) {
|
) {
|
||||||
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words`, {
|
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json', Authorization: token },
|
headers: { 'Content-Type': 'application/json', Authorization: `Bearer ${token}` },
|
||||||
body: JSON.stringify({ words: [word] }),
|
body: JSON.stringify({ words: [word] }),
|
||||||
})
|
})
|
||||||
return res.json()
|
return res.json()
|
||||||
@@ -524,7 +524,7 @@ export async function deleteDbPictureWord(
|
|||||||
) {
|
) {
|
||||||
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words/${junctionId}`, {
|
const res = await fetch(`/api/directus/db-pictures/${pictureId}/words/${junctionId}`, {
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
headers: { Authorization: token },
|
headers: { Authorization: `Bearer ${token}` },
|
||||||
})
|
})
|
||||||
return res.json()
|
return res.json()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user