This commit is contained in:
nguyen van thai
2024-07-16 22:54:15 +07:00
parent 6f571d9549
commit 5f9525371d
6 changed files with 24 additions and 20 deletions
+4 -4
View File
@@ -1,5 +1,6 @@
import { H3Event } from 'h3';
import Base from './base'
import { useCookie } from 'nuxt/app';
export type PollResponse = {
id?: number; // Mã định danh
@@ -18,7 +19,7 @@ export const create = async (event: H3Event) => {
const { item }: any = await $fetch(`${apiUrl}/cms/poll-response`, {
method: 'POST',
headers: {
site: 1
site: Number(useCookie('site').value)
},
body: payload
})
@@ -32,14 +33,13 @@ export const create = async (event: H3Event) => {
export const fetchByPollId = async (event: H3Event) => {
try {
const { apiUrl } = useRuntimeConfig().public
const { pollId }: any = getQuery(event)
const { items }: PollResponse[] | any = await $fetch(`${apiUrl}/cms/poll-response/poll:${pollId}`, {
method: 'GET',
headers: {
site: 1
}
site: Number(useCookie('site').value)
},
})
return items