Fix config API to return data directly instead of wrapped in config object

This commit is contained in:
Torsten Schulz (local)
2025-10-22 12:15:59 +02:00
parent 71f4dea756
commit 3b004d482f
10 changed files with 654 additions and 597 deletions

View File

@@ -1,5 +1,5 @@
{ {
"date": "2025-10-22T10:11:31.068Z", "date": "2025-10-22T10:13:26.492Z",
"preset": "node-server", "preset": "node-server",
"framework": { "framework": {
"name": "nuxt", "name": "nuxt",

View File

@@ -1 +1 @@
{"id":"58625344-59dd-45bd-90b3-a1b0a73aa009","timestamp":1761127882899} {"id":"0fb48973-274b-45d3-85a9-1014858b2ee4","timestamp":1761127998427}

View File

@@ -351,7 +351,7 @@ const client_manifest = {
"module": true, "module": true,
"prefetch": true, "prefetch": true,
"preload": true, "preload": true,
"file": "DKfClUWe.js", "file": "DdWIoJJP.js",
"name": "entry", "name": "entry",
"src": "node_modules/nuxt/dist/app/entry.js", "src": "node_modules/nuxt/dist/app/entry.js",
"isEntry": true, "isEntry": true,
@@ -361,14 +361,14 @@ const client_manifest = {
"node_modules/nuxt/dist/app/components/error-500.vue" "node_modules/nuxt/dist/app/components/error-500.vue"
], ],
"css": [ "css": [
"entry.iTNxcbjl.css" "entry.CxD55d1W.css"
], ],
"assets": [ "assets": [
"Harheimer TC.CKfYAfp1.svg" "Harheimer TC.CKfYAfp1.svg"
] ]
}, },
"entry.iTNxcbjl.css": { "entry.CxD55d1W.css": {
"file": "entry.iTNxcbjl.css", "file": "entry.CxD55d1W.css",
"resourceType": "style", "resourceType": "style",
"prefetch": true, "prefetch": true,
"preload": true "preload": true

View File

@@ -1933,6 +1933,72 @@ const _sfc_main$4 = {
}), }),
_: 1 _: 1
}, _parent)); }, _parent));
_push(`<div class="border-t border-gray-700 my-1"></div>`);
_push(ssrRenderComponent(_component_NuxtLink, {
to: "/cms/ueber-uns",
onClick: ($event) => showCmsDropdown.value = false,
class: "block px-4 py-2 text-sm text-gray-300 hover:bg-primary-600 hover:text-white transition-colors"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(` Über uns `);
} else {
return [
createTextVNode(" Über uns ")
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_NuxtLink, {
to: "/cms/geschichte",
onClick: ($event) => showCmsDropdown.value = false,
class: "block px-4 py-2 text-sm text-gray-300 hover:bg-primary-600 hover:text-white transition-colors"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(` Geschichte `);
} else {
return [
createTextVNode(" Geschichte ")
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_NuxtLink, {
to: "/cms/tt-regeln",
onClick: ($event) => showCmsDropdown.value = false,
class: "block px-4 py-2 text-sm text-gray-300 hover:bg-primary-600 hover:text-white transition-colors"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(` TT-Regeln `);
} else {
return [
createTextVNode(" TT-Regeln ")
];
}
}),
_: 1
}, _parent));
_push(ssrRenderComponent(_component_NuxtLink, {
to: "/cms/satzung",
onClick: ($event) => showCmsDropdown.value = false,
class: "block px-4 py-2 text-sm text-gray-300 hover:bg-primary-600 hover:text-white transition-colors"
}, {
default: withCtx((_, _push2, _parent2, _scopeId) => {
if (_push2) {
_push2(` Satzung `);
} else {
return [
createTextVNode(" Satzung ")
];
}
}),
_: 1
}, _parent));
_push(`<div class="border-t border-gray-700 my-1"></div>`);
_push(ssrRenderComponent(_component_NuxtLink, { _push(ssrRenderComponent(_component_NuxtLink, {
to: "/mitgliederbereich/news", to: "/mitgliederbereich/news",
onClick: ($event) => showCmsDropdown.value = false, onClick: ($event) => showCmsDropdown.value = false,
@@ -1981,6 +2047,7 @@ const _sfc_main$4 = {
}), }),
_: 1 _: 1
}, _parent)); }, _parent));
_push(`<div class="border-t border-gray-700 my-1"></div>`);
_push(ssrRenderComponent(_component_NuxtLink, { _push(ssrRenderComponent(_component_NuxtLink, {
to: "/cms/einstellungen", to: "/cms/einstellungen",
onClick: ($event) => showCmsDropdown.value = false, onClick: ($event) => showCmsDropdown.value = false,

View File

@@ -1,13 +1,13 @@
const interopDefault = r => r.default || r || []; const interopDefault = r => r.default || r || [];
const styles = { const styles = {
"components/Hero.vue": () => import('./Hero-styles.03iOjY05.mjs').then(interopDefault),
"components/PublicNews.vue": () => import('./PublicNews-styles.nhqk16g5.mjs').then(interopDefault),
"node_modules/nuxt/dist/app/components/error-404.vue": () => import('./error-404-styles.BsF5Lbhq.mjs').then(interopDefault), "node_modules/nuxt/dist/app/components/error-404.vue": () => import('./error-404-styles.BsF5Lbhq.mjs').then(interopDefault),
"node_modules/nuxt/dist/app/components/error-500.vue": () => import('./error-500-styles.Dccc6iq5.mjs').then(interopDefault), "node_modules/nuxt/dist/app/components/error-500.vue": () => import('./error-500-styles.Dccc6iq5.mjs').then(interopDefault),
"components/Hero.vue?vue&type=style&index=0&scoped=779d39d7&lang.css": () => import('./Hero-styles.03iOjY05.mjs').then(interopDefault), "components/Hero.vue": () => import('./Hero-styles.03iOjY05.mjs').then(interopDefault),
"components/PublicNews.vue?vue&type=style&index=0&scoped=f894f108&lang.css": () => import('./PublicNews-styles.nhqk16g5.mjs').then(interopDefault), "components/PublicNews.vue": () => import('./PublicNews-styles.nhqk16g5.mjs').then(interopDefault),
"node_modules/nuxt/dist/app/components/error-404.vue?vue&type=style&index=0&scoped=b728498f&lang.css": () => import('./error-404-styles.BsF5Lbhq.mjs').then(interopDefault), "node_modules/nuxt/dist/app/components/error-404.vue?vue&type=style&index=0&scoped=b728498f&lang.css": () => import('./error-404-styles.BsF5Lbhq.mjs').then(interopDefault),
"node_modules/nuxt/dist/app/components/error-500.vue?vue&type=style&index=0&scoped=70d84538&lang.css": () => import('./error-500-styles.Dccc6iq5.mjs').then(interopDefault) "node_modules/nuxt/dist/app/components/error-500.vue?vue&type=style&index=0&scoped=70d84538&lang.css": () => import('./error-500-styles.Dccc6iq5.mjs').then(interopDefault),
"components/Hero.vue?vue&type=style&index=0&scoped=779d39d7&lang.css": () => import('./Hero-styles.03iOjY05.mjs').then(interopDefault),
"components/PublicNews.vue?vue&type=style&index=0&scoped=f894f108&lang.css": () => import('./PublicNews-styles.nhqk16g5.mjs').then(interopDefault)
}; };
export { styles as default }; export { styles as default };

File diff suppressed because it is too large Load Diff

View File

@@ -272,7 +272,7 @@ async function renderInlineStyles(usedModules) {
const renderSSRHeadOptions = {"omitLineBreaks":true}; const renderSSRHeadOptions = {"omitLineBreaks":true};
const entryFileName = "DKfClUWe.js"; const entryFileName = "DdWIoJJP.js";
globalThis.__buildAssetsURL = buildAssetsURL; globalThis.__buildAssetsURL = buildAssetsURL;
globalThis.__publicAssetsURL = publicAssetsURL; globalThis.__publicAssetsURL = publicAssetsURL;

View File

@@ -505,7 +505,7 @@ const loadConfig = async () => {
isLoading.value = true isLoading.value = true
try { try {
const response = await $fetch('/api/config') const response = await $fetch('/api/config')
config.value = response.config config.value = response
} catch (error) { } catch (error) {
errorMessage.value = 'Fehler beim Laden der Konfiguration.' errorMessage.value = 'Fehler beim Laden der Konfiguration.'
} finally { } finally {
@@ -521,7 +521,7 @@ const saveConfig = async () => {
try { try {
await $fetch('/api/config', { await $fetch('/api/config', {
method: 'PUT', method: 'PUT',
body: { config: config.value } body: config.value
}) })
successMessage.value = 'Konfiguration erfolgreich gespeichert!' successMessage.value = 'Konfiguration erfolgreich gespeichert!'

View File

@@ -15,10 +15,7 @@ export default defineEventHandler(async (event) => {
const data = await fs.readFile(configFile, 'utf-8') const data = await fs.readFile(configFile, 'utf-8')
const config = JSON.parse(data) const config = JSON.parse(data)
return { return config
success: true,
config
}
} catch (error) { } catch (error) {
console.error('Fehler beim Laden der Config:', error) console.error('Fehler beim Laden der Config:', error)
throw createError({ throw createError({

View File

@@ -42,15 +42,8 @@ export default defineEventHandler(async (event) => {
const body = await readBody(event) const body = await readBody(event)
if (!body.config) {
throw createError({
statusCode: 400,
message: 'Konfigurationsdaten fehlen.'
})
}
const configFile = getDataPath('config.json') const configFile = getDataPath('config.json')
await fs.writeFile(configFile, JSON.stringify(body.config, null, 2), 'utf-8') await fs.writeFile(configFile, JSON.stringify(body, null, 2), 'utf-8')
return { return {
success: true, success: true,