20 lines
482 B
TypeScript
20 lines
482 B
TypeScript
export const usePollStore = defineStore('usepollStore', () => {
|
|
async function fetchById(id: string) {
|
|
const { data, error } = await useFetch<any>(`/api/services/poll-by-id`, {
|
|
query: {
|
|
pollId: id
|
|
}
|
|
})
|
|
if(error.value) {
|
|
return null
|
|
}
|
|
|
|
return data.value
|
|
}
|
|
|
|
return { fetchById }
|
|
})
|
|
|
|
if(import.meta.hot) {
|
|
import.meta.hot.accept(acceptHMRUpdate(useTagStore, import.meta.hot))
|
|
} |