43 lines
1.3 KiB
TypeScript
43 lines
1.3 KiB
TypeScript
import { H3Event } from 'h3';
|
|
import Base from './base'
|
|
|
|
export type Poll = {
|
|
id?: number; // Mã định danh
|
|
siteId?: number; // Mã hệ thống
|
|
title?: string; // Tiêu đề
|
|
code?: string; // Nhận diện
|
|
keywords?: string; // Từ khóa
|
|
thumbnail?: string; // Ảnh nhỏ
|
|
description?: string; // Mô tả
|
|
startTime?: string; // Bắt đầu (string)
|
|
endTime?: string; // Kết thúc (string)
|
|
type?: number; // Phân loại
|
|
settings?: object; // Thiết lập: PollSettings (Json)
|
|
features?: string; // Đặc trưng: Featured (nổi bật)
|
|
taxonomy?: string; // Phân nhóm
|
|
isPublished?: boolean; // Đã xuất bản
|
|
publishedBy?: number; // Xuất bản bởi
|
|
publishedOn?: string; // Xuất bản vào lúc (string)
|
|
expiresOn?: string; // Đã hết hạn vào lúc (string)
|
|
order?: number; // Thứ tự sắp xếp
|
|
status?: number; // Trạng thái
|
|
}
|
|
|
|
export const fetchById = async (event: H3Event) => {
|
|
try {
|
|
|
|
const { apiUrl } = useRuntimeConfig().public
|
|
const { pollId}: any = getQuery(event)
|
|
const { item }: any = await $fetch(`${apiUrl}/cms/poll/${pollId}`, {
|
|
method: 'GET',
|
|
headers: {
|
|
site: 1
|
|
}
|
|
})
|
|
|
|
return item
|
|
|
|
} catch (error) {
|
|
handleError(error);
|
|
}
|
|
} |