Fix config API to return data directly instead of wrapped in config object
This commit is contained in:
@@ -15,10 +15,7 @@ export default defineEventHandler(async (event) => {
|
||||
const data = await fs.readFile(configFile, 'utf-8')
|
||||
const config = JSON.parse(data)
|
||||
|
||||
return {
|
||||
success: true,
|
||||
config
|
||||
}
|
||||
return config
|
||||
} catch (error) {
|
||||
console.error('Fehler beim Laden der Config:', error)
|
||||
throw createError({
|
||||
|
||||
@@ -42,15 +42,8 @@ export default defineEventHandler(async (event) => {
|
||||
|
||||
const body = await readBody(event)
|
||||
|
||||
if (!body.config) {
|
||||
throw createError({
|
||||
statusCode: 400,
|
||||
message: 'Konfigurationsdaten fehlen.'
|
||||
})
|
||||
}
|
||||
|
||||
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 {
|
||||
success: true,
|
||||
|
||||
Reference in New Issue
Block a user