thainnv-dev: Nhúng

This commit is contained in:
nguyen van thai
2024-06-06 13:29:22 +07:00
parent 0a7774b7f4
commit c217ed82c9
25 changed files with 382 additions and 45 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ export const listArticleCondition = async (event: H3Event) => {
try {
const payload = await readBody<any>(event)
const { apiUrl } = useRuntimeConfig().public
const { items }: any = await $fetch(`${apiUrl}/cms/article/condition`, {
const { items }: any = await $fetch(`${apiUrl}/cms/digital-article/condition`, {
method: "POST",
headers: {
Site: 1
+1 -1
View File
@@ -101,7 +101,7 @@ export const getDynamicPageByCode = async (event : any) => {
try {
const { apiUrl } = useRuntimeConfig().public
const slug = event.context.params.slug;
const { item }: any = await $fetch(`${apiUrl}/cms/overview-page/slug:${slug}`, {
const { item }: any = await $fetch(`${apiUrl}/cms/page/overview-page/slug:${slug}`, {
headers: new Headers({
site: '1' || 1,
}),
+22
View File
@@ -0,0 +1,22 @@
import { H3Event } from 'h3';
import Base from './base'
export const fetchByPollId = async (event: H3Event) => {
try {
const { apiUrl } = useRuntimeConfig().public
const { pollId}: any = getQuery(event)
const { items }: any = await $fetch(`${apiUrl}/cms/poll-option/poll:${pollId}`, {
method: 'GET',
headers: {
site: 1
}
})
return items
} catch (error) {
handleError(error);
}
}
+24
View File
@@ -0,0 +1,24 @@
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);
}
}
+43
View File
@@ -0,0 +1,43 @@
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);
}
}