mirror of
https://github.com/OpenSquawk/OpenSquawk
synced 2026-08-05 17:05:53 +08:00
typescript
This commit is contained in:
@@ -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()
|
||||
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Reference in New Issue
Block a user