This commit is contained in:
2024-09-02 16:58:23 +02:00
parent c77503ed45
commit 1b0dc0f27d
52 changed files with 817 additions and 1379 deletions

View File

@@ -0,0 +1,17 @@
import { useValidatedBody } from 'h3-zod'
import { UpdateUserSchema } from '~~/types/types'
export default defineEventHandler(async (event) => {
const { user } = await requireUserSession(event)
const body = await useValidatedBody(event, UpdateUserSchema)
const updatedUser = {
...user,
...body,
}
await updateUser(user.id, updatedUser)
await replaceUserSession(event, updatedUser)
return sendNoContent(event, 204)
})