This commit is contained in:
2024-09-02 20:44:47 +02:00
parent c89638262f
commit 5d00a5a090
28 changed files with 160 additions and 2122 deletions

View File

@@ -0,0 +1,20 @@
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 setUserSession(event, {
id: user.id,
user: updatedUser,
})
return sendNoContent(event, 204)
})