thainv-dev: tạo lại cấu trúc folder và làm UI

This commit is contained in:
nguyen van thai
2024-06-12 17:17:49 +07:00
parent c217ed82c9
commit 5b1e0af397
44 changed files with 2674 additions and 228 deletions
+24
View File
@@ -0,0 +1,24 @@
import type { Survey } from '~/server/models/survey';
export const useSurveyStore = defineStore('useSurveyStore', () => {
const currentSurvey = shallowReactive<Survey>({})
async function fetchById(id: number) {
try {
const { data } = await useFetch<any>(`/api/services/survey/get-by-id`, {
query: {
surveyId: id
}
})
data.value && (Object.assign(currentSurvey, data.value))
return currentSurvey
} catch(error) {
}
}
return { fetchById, currentSurvey }
})
if(import.meta.hot) {
import.meta.hot.accept(acceptHMRUpdate(useSurveyStore, import.meta.hot))
}