Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/danielroe/roe.dev. This is the code and content for my personal website, built in Nuxt. roe.dev
Something went wrong. Try again.
123456789101112131415161718192021222324252627282930import { sendPushoverNotification } from '../utils/pushover'
export default defineEventHandler(async event => { if (event.method === 'OPTIONS') return null const sanity = useSanity(event)
assertMethod(event, 'POST') const { question } = await readBody(event) if (!question) throw createError({ statusCode: 422 })
event.waitUntil(sanity.client.create({ _type: 'ama', content: question, publishStatus: 'draft', platforms: { bluesky: true, linkedin: true, mastodon: true, youtubeShorts: true, }, }).catch(console.error))
await sendPushoverNotification(event, { title: 'Anonymous question', message: question, priority: 0, }) return null})