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