thainv-dev: Fix

This commit is contained in:
nguyen van thai
2024-07-17 10:35:35 +07:00
parent 5f9525371d
commit 795cd47e41
18 changed files with 78 additions and 43 deletions
+7 -11
View File
@@ -1,12 +1,17 @@
import type { Poll } from "~/server/models/poll"
export const usePollStore = defineStore('usePollStore', () => {
const currentPoll = shallowReactive<Poll>({})
const url : any = useRequestURL();
const host = url.hostname.split('.')[0];
async function fetchById(id: string) {
try {
const { data } = await useFetch<any>(`/api/services/poll-by-id`, {
query: {
pollId: id
pollId: id,
site: host
}
})
@@ -16,16 +21,7 @@ export const usePollStore = defineStore('usePollStore', () => {
}
}
async function categoryId() {
try {
const { data } = await useFetch(`/api/services/category-tree`)
return data.value
} catch (error) {}
}
return { fetchById, currentPoll, categoryId }
return { fetchById, currentPoll }
})
if(import.meta.hot) {