mirror of
https://github.com/ArthurDanjou/arthome.git
synced 2026-01-30 02:57:48 +01:00
Working on arthome
This commit is contained in:
20
server/api/tabs/index.post.ts
Normal file
20
server/api/tabs/index.post.ts
Normal file
@@ -0,0 +1,20 @@
|
||||
import { useValidatedBody } from 'h3-zod'
|
||||
import { CreateTabSchema } from '~~/types/types'
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
try {
|
||||
const body = await useValidatedBody(event, CreateTabSchema)
|
||||
await useDrizzle().insert(tables.tabs).values({
|
||||
name: body.name,
|
||||
icon: body.icon,
|
||||
color: body.color,
|
||||
nameVisible: body.nameVisible,
|
||||
categoryId: body.categoryId,
|
||||
link: body.link,
|
||||
})
|
||||
return { statusCode: 200 }
|
||||
}
|
||||
catch (err) {
|
||||
return { err }
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user