12 lines
293 B
JavaScript
12 lines
293 B
JavaScript
|
import { addComment } from '../controller'
|
||
|
import { useBody } from 'h3'
|
||
|
|
||
|
export default defineEventHandler(async (event) => {
|
||
|
try {
|
||
|
const body = await useBody(event)
|
||
|
addComment(body)
|
||
|
return { success: true }
|
||
|
} catch (e) {
|
||
|
return { success: false, reason: e.message }
|
||
|
}
|
||
|
})
|