typescript

This commit is contained in:
itsrubberduck
2026-02-17 18:19:55 +01:00
parent 8f45c3397d
commit f88fced5b1
16 changed files with 60 additions and 33 deletions

View File

@@ -16,7 +16,7 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'Missing user ID' })
}
const body = await readBody<UpdateNotesBody>(event).catch(() => ({}))
const body = await readBody<UpdateNotesBody>(event).catch(() => ({}) as UpdateNotesBody)
const rawNotes = typeof body.notes === 'string' ? body.notes.replace(/\r\n/g, '\n') : ''
const notes = rawNotes.trim()

View File

@@ -15,7 +15,7 @@ export default defineEventHandler(async (event) => {
throw createError({ statusCode: 400, statusMessage: 'Missing user ID' })
}
const body = await readBody<UpdateRoleBody>(event).catch(() => ({}))
const body = await readBody<UpdateRoleBody>(event).catch(() => ({}) as UpdateRoleBody)
const role = body.role?.trim()
if (!role || !['user', 'admin', 'dev'].includes(role)) {