import type { PollOption } from "~/server/models/poll-option" export const usePollOptionStore = defineStore('usePollOptionStore', () => { const currentPollOption = shallowReactive({}) const currentPollOptions = shallowRef([]) const url : any = useRequestURL(); const host = url.hostname.split('.')[0]; async function fetchByPollId(id: string) { try { const { data } = await useFetch(`/api/services/poll-option/pollId`, { query: { pollId: id, site: host } }) data.value && (currentPollOptions.value = data.value) return currentPollOptions.value } catch(error) {} } return { currentPollOptions, fetchByPollId } }) if(import.meta.hot) { import.meta.hot.accept(acceptHMRUpdate(usePollOptionStore, import.meta.hot)) }