refiniments

This commit is contained in:
Florinda
2024-12-19 13:05:37 +01:00
parent 3607442539
commit 9d2e4f1a92
5 changed files with 108 additions and 8 deletions

View File

@@ -0,0 +1,38 @@
import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
import { KsCodeRepoService } from '../service/KsCodeRepoService';
import { LoadingStore } from './LoadingStore';
export const KsCodeRepoStore = defineStore('ks_code_repo_store', () => {
const lstKsCodeRepo = ref([])
const selectedKsCodeRepo = ref(null)
const loadingStore = LoadingStore()
async function fetchKsCodeRepoStore() {
console.log("i'm in");
loadingStore.scenario_loading = true;
return KsCodeRepoService.getKsCodeRepo().then(resp => {
lstKsCodeRepo.value = resp.data;
console.log("lstKsCodeRepo", lstKsCodeRepo.value);
loadingStore.scenario_loading = false;
});
}
const KsCodeRepo = computed(() => {
return lstKsCodeRepo.value
})
const getSelectedKsCodeRepo = computed(() => {
return selectedKsCodeRepo.value
})
async function setSelectedKsCodeRepo(ksDoc){
selectedKsCodeRepo.value = ksDoc
console.log("selectedKsCodeRepo", selectedKsCodeRepo.value);
}
return { fetchKsCodeRepoStore, selectedKsCodeRepo, KsCodeRepo, getSelectedKsCodeRepo, setSelectedKsCodeRepo}
})