Some checks failed
Dev Deployment (Zero Downtime) / deploy-dev (push) Has been cancelled
46 lines
1.3 KiB
JavaScript
46 lines
1.3 KiB
JavaScript
#!/usr/bin/env node
|
|
require('dotenv').config();
|
|
const DIRECTUS_URL = process.env.DIRECTUS_URL || 'https://cms.dk0.dev';
|
|
const DIRECTUS_TOKEN = process.env.DIRECTUS_STATIC_TOKEN;
|
|
|
|
async function api(endpoint, method = 'PATCH', body = null) {
|
|
const res = await fetch(`${DIRECTUS_URL}/${endpoint}`, {
|
|
method,
|
|
headers: { 'Authorization': `Bearer ${DIRECTUS_TOKEN}`, 'Content-Type': 'application/json' },
|
|
body: body ? JSON.stringify(body) : null
|
|
});
|
|
return res.ok ? await res.json() : { error: true };
|
|
}
|
|
|
|
async function finalDirectusUiFix() {
|
|
console.log('🛠 Finaler UI-Fix für Status und Übersetzungen...');
|
|
|
|
// 1. Status-Dropdown Optionen hinzufügen
|
|
await api('fields/book_reviews/status', 'PATCH', {
|
|
meta: {
|
|
interface: 'select-dropdown',
|
|
options: {
|
|
choices: [
|
|
{ text: 'Draft', value: 'draft' },
|
|
{ text: 'Published', value: 'published' }
|
|
]
|
|
}
|
|
}
|
|
});
|
|
|
|
// 2. Translations Interface auf Tabs (translations) umstellen
|
|
await api('fields/book_reviews/translations', 'PATCH', {
|
|
meta: {
|
|
interface: 'translations',
|
|
special: ['translations'],
|
|
options: {
|
|
languageField: 'languages_code'
|
|
}
|
|
}
|
|
});
|
|
|
|
console.log('✅ UI-Einstellungen korrigiert! Bitte lade Directus neu.');
|
|
}
|
|
|
|
finalDirectusUiFix().catch(console.error);
|