mirror of
https://github.com/LaconicNetwork/laconic.com.git
synced 2026-02-28 21:44:09 +00:00
56 lines
1.4 KiB
TypeScript
56 lines
1.4 KiB
TypeScript
import { NextApiRequest, NextApiResponse } from 'next'
|
|
|
|
import { internalServerError, success } from '../../lib/api-responses'
|
|
import { notionAlt } from '../../lib/notion'
|
|
|
|
export default async (req: NextApiRequest, res: NextApiResponse) => {
|
|
try {
|
|
const { name, email, message, inquiry, role, company, jurisdiction } =
|
|
JSON.parse(req.body)
|
|
await notionAlt.pages.create({
|
|
parent: {
|
|
database_id: '90a7d71e342f4b91b7ca263a14d839ea' as string
|
|
},
|
|
properties: {
|
|
Name: {
|
|
title: [
|
|
{
|
|
text: {
|
|
content: name
|
|
}
|
|
}
|
|
]
|
|
},
|
|
Email: {
|
|
email,
|
|
type: 'email'
|
|
},
|
|
Message: {
|
|
type: 'rich_text',
|
|
rich_text: [{ text: { content: message }, type: 'text' }]
|
|
},
|
|
Role: {
|
|
type: 'rich_text',
|
|
rich_text: [{ text: { content: role }, type: 'text' }]
|
|
},
|
|
Company: {
|
|
type: 'rich_text',
|
|
rich_text: [{ text: { content: company }, type: 'text' }]
|
|
},
|
|
'Legal jurisdiction': {
|
|
type: 'rich_text',
|
|
rich_text: [{ text: { content: jurisdiction }, type: 'text' }]
|
|
},
|
|
Inquiry: {
|
|
type: 'select',
|
|
select: { name: inquiry }
|
|
}
|
|
}
|
|
})
|
|
|
|
success(res)
|
|
} catch (error) {
|
|
internalServerError(res, error)
|
|
}
|
|
}
|