thainv-dev: Fix
This commit is contained in:
+7
-11
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user