Skip to content

Commit

Permalink
chore: provide safely config
Browse files Browse the repository at this point in the history
  • Loading branch information
hywax committed Feb 1, 2024
1 parent 05cb0ea commit e38a7a5
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion server/api/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@ import type { CompleteConfig } from '~/types'

export default defineEventHandler(async () => {
const storage = useStorage('main')
const config = await storage.getItem<CompleteConfig>('config')

return await storage.getItem<CompleteConfig>('config')
if (!config) {
throw createError({
statusCode: 500,
statusMessage: 'Bad loading config',
})
}

return extractSafelyConfig(config)
})

0 comments on commit e38a7a5

Please sign in to comment.