Files
NSG_PORTAL_V2/server/models/poll-option.ts
T
2024-06-12 17:17:49 +07:00

34 lines
959 B
TypeScript

import { H3Event } from 'h3';
import Base from './base'
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
responsesCount?: 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 { items }: PollOption[] | any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, {
method: 'GET',
headers: {
site: 1
}
})
return items
} catch (error) {
handleError(error);
}
}