Files
NSG_PORTAL_V2/server/models/poll-option.ts
T

34 lines
959 B
TypeScript
Raw Normal View History

2024-06-06 13:29:22 +07:00
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
}
2024-06-06 13:29:22 +07:00
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}`, {
2024-06-06 13:29:22 +07:00
method: 'GET',
headers: {
site: 1
}
})
return items
} catch (error) {
handleError(error);
}
}