thainnv-dev: Nhúng

This commit is contained in:
nguyen van thai
2024-06-06 13:29:22 +07:00
parent 0a7774b7f4
commit c217ed82c9
25 changed files with 382 additions and 45 deletions
+20
View File
@@ -0,0 +1,20 @@
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))
}
+19
View File
@@ -0,0 +1,19 @@
export const usePollResponseStore = defineStore('usepollResponseStore', () => {
async function create(pollResponse: any) {
const { data, error } = await useFetch<any>(`/api/services/poll-response`, {
method: 'POST',
body: pollResponse
})
if(error.value) {
return null
}
return data.value
}
return { create }
})
if(import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useTagStore, import.meta.hot))
}
+20
View File
@@ -0,0 +1,20 @@
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))
}