import { H3Event } from 'h3'; import Base from './base' import { useCookie } from 'nuxt/app'; export type PollOption = { id?: number; // Mã định danh siteId?: number; // Mã hệ thống pollId?: number; // Mã bình chọn title?: string; // Tiêu đề thumbnail?: string; // Ảnh đại diện description?: string; // Mô tả type?: number; // Phân loại order?: number; // Sắp xếp status?: number; // Trạng thái responseCount?: number //số lượng response của option } export const fetchByPollId = async (event: H3Event) => { try { const { apiUrl } = useRuntimeConfig().public const { pollId }: any = getQuery(event) const query = getQuery(event) const { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, { method: 'GET', headers: { site: getSite(query.site).toString() }, }) return items } catch (error) { handleError(error); } }