diff --git a/src/service/KsVideoGroupService.js b/src/service/KsVideoGroupService.js new file mode 100644 index 0000000..a9abc1b --- /dev/null +++ b/src/service/KsVideoGroupService.js @@ -0,0 +1,20 @@ +import axios from 'axios'; + +export const KsVideoGroupService = { + getKsVideoGroups(projectId) { + return axios.get(`/project`, { + params: { + projectId: projectId + } + }); + }, + + findByProjectId(projectId) { + return axios.get(`/project/${projectId}`); + }, + + + getVideoGroupById(id) { + return axios.get(`/${id}`); + } +}; diff --git a/src/stores/KsVideoGroupStore.js b/src/stores/KsVideoGroupStore.js new file mode 100644 index 0000000..425a173 --- /dev/null +++ b/src/stores/KsVideoGroupStore.js @@ -0,0 +1,40 @@ +import { defineStore } from 'pinia'; +import { computed, ref } from 'vue'; +import { KsVideoGroupService } from '../service/KsVideoGroupService'; + +export const KsVideoGroupStore = defineStore('ksvideogroup_store', () => { + const lstKsVideoGroup = ref([]); + const selectedKsVideoGroup = ref(null); + + async function fetchKsVideoGroup(projectId) { + try { + const response = await KsVideoGroupService.getKsVideoGroups(projectId); + lstKsVideoGroup.value = response.data; + } catch (error) { + console.error('Error fetching video groups:', error); + } finally { + } + } + + const ksVideoGroup = computed(() => { + return lstKsVideoGroup.value; + }); + + const getSelectedKsVideoGroup = computed(() => { + return selectedKsVideoGroup.value; + }); + + async function setSelectedKsVideoGroup(group) { + selectedKsVideoGroup.value = group; + console.log('selectedVideoGroup', selectedKsVideoGroup.value); + } + + return { + fetchKsVideoGroup, + selectedKsVideoGroup, + lstKsVideoGroup, + ksVideoGroup, + getSelectedKsVideoGroup, + setSelectedKsVideoGroup + }; +}); diff --git a/src/views/pages/ScenarioExec.vue b/src/views/pages/ScenarioExec.vue index 68dc082..b89d9a3 100644 --- a/src/views/pages/ScenarioExec.vue +++ b/src/views/pages/ScenarioExec.vue @@ -17,10 +17,9 @@