history exec scenario page

This commit is contained in:
Florinda
2024-10-30 09:23:48 +01:00
parent 440219ee24
commit 2f5a3e688a
5 changed files with 171 additions and 28 deletions

View File

@@ -0,0 +1,36 @@
import { defineStore } from 'pinia';
import { computed, ref } from 'vue';
import { ScenarioService } from '../service/ScenarioService';
import { LoadingStore } from './LoadingStore';
export const ScenarioExecutionStore = defineStore('scenario_execution_store', () => {
const lstScenarioExecution = ref([])
const selectedExecScenario = ref(null)
const loadingStore = LoadingStore()
async function fetchScenariosExecution() {
loadingStore.scenario_loading = true;
await ScenarioService.getExecScenariosByUser().then(resp => {
lstScenarioExecution.value = resp.data;
loadingStore.scenario_loading = false;
});
}
const scenariosExecution = computed(() => {
return lstScenarioExecution.value
})
const getSelectedExecScenario = computed(() => {
return selectedExecScenario.value
})
async function setSelectedExecScenario(execScenario){
selectedExecScenario.value = execScenario
console.log("selectedExecScenario", selectedExecScenario.value);
}
return { fetchScenariosExecution, selectedExecScenario, lstScenarioExecution, scenariosExecution, getSelectedExecScenario, setSelectedExecScenario}
})