export default defineEventHandler(async (event) => {
  const config = useRuntimeConfig()
  const body = await readBody(event)
  const url = `${config.nocodbUrl}/api/v2/tables/${config.avisTableId}/records`

  const data = await $fetch(url, {
    method: 'POST',
    headers: {
      'xc-token': config.nocodbToken,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify(body),
  })

  return data
})
