forked from verdnatura/salix-front
fix(ZoneCard): fix ZoneLocations redirections
This commit is contained in:
parent
a929dec2ab
commit
045a828bf9
|
@ -42,16 +42,15 @@ const arrayData = useArrayData(datakey, {
|
||||||
const { store } = arrayData;
|
const { store } = arrayData;
|
||||||
const storeData = computed(() => store.data);
|
const storeData = computed(() => store.data);
|
||||||
|
|
||||||
const nodes = ref([
|
const defaultNode = {
|
||||||
{
|
|
||||||
id: null,
|
id: null,
|
||||||
name: props.rootLabel,
|
name: props.rootLabel,
|
||||||
sons: true,
|
sons: true,
|
||||||
tickable: false,
|
tickable: false,
|
||||||
noTick: true,
|
noTick: true,
|
||||||
children: [{}],
|
children: [{}],
|
||||||
},
|
};
|
||||||
]);
|
const nodes = ref([defaultNode]);
|
||||||
|
|
||||||
const _tickedNodes = computed({
|
const _tickedNodes = computed({
|
||||||
get: () => props.tickedNodes,
|
get: () => props.tickedNodes,
|
||||||
|
@ -131,6 +130,7 @@ function getNodeIds(node) {
|
||||||
|
|
||||||
watch(storeData, async (val) => {
|
watch(storeData, async (val) => {
|
||||||
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
|
// Se triggerea cuando se actualiza el store.data, el cual es el resultado del fetch de la searchbar
|
||||||
|
if (!nodes.value[0]) nodes.value = [defaultNode];
|
||||||
nodes.value[0].childs = [...val];
|
nodes.value[0].childs = [...val];
|
||||||
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
const fetchedNodeKeys = val.flatMap(getNodeIds);
|
||||||
state.set('Tree', [...fetchedNodeKeys]);
|
state.set('Tree', [...fetchedNodeKeys]);
|
||||||
|
|
Loading…
Reference in New Issue