Poll
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user