24 lines
540 B
TypeScript
24 lines
540 B
TypeScript
|
|
import { H3Event } from 'h3';
|
||
|
|
import Base from './base'
|
||
|
|
|
||
|
|
|
||
|
|
export const create = async (event: H3Event) => {
|
||
|
|
try {
|
||
|
|
const { apiUrl } = useRuntimeConfig().public
|
||
|
|
const payload = await readBody<any>(event)
|
||
|
|
const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, {
|
||
|
|
method: 'POST',
|
||
|
|
headers: {
|
||
|
|
site: 1
|
||
|
|
},
|
||
|
|
body: {
|
||
|
|
payload
|
||
|
|
}
|
||
|
|
})
|
||
|
|
|
||
|
|
return item
|
||
|
|
|
||
|
|
} catch (error) {
|
||
|
|
handleError(error);
|
||
|
|
}
|
||
|
|
}
|