0
0
Fork 0
This commit is contained in:
Carlos Satorres 2023-10-22 07:19:33 +02:00
parent cea811903e
commit dfa29875d5
3 changed files with 15 additions and 5 deletions

View File

@ -1,10 +1,12 @@
<script setup>
import { onMounted, useSlots, ref, watch } from 'vue';
import { onMounted, useSlots, ref, watch, watchEffect } from 'vue';
import { useI18n } from 'vue-i18n';
import axios from 'axios';
import SkeletonDescriptor from 'components/ui/SkeletonDescriptor.vue';
import { useArrayData } from 'src/composables/useArrayData';
const $props = defineProps({
dataKey: { type: String, default: null },
url: {
type: String,
default: '',
@ -26,14 +28,17 @@ const $props = defineProps({
default: 0,
},
});
const arrayData = useArrayData('claimData');
console.log('arraydata en descriptor', arrayData.store.data);
const slots = useSlots();
const { t } = useI18n();
const entity = ref(null);
let lastUrl = ref(null);
entity.value = arrayData.store.data;
///
onMounted(async () => {
await fetch();
//await fetch();
});
const emit = defineEmits(['onFetch']);
@ -53,7 +58,11 @@ async function fetch() {
watch($props, async () => {
if (lastUrl.value == $props.url) return;
entity.value = null;
await fetch();
/* await fetch(); */
});
watchEffect(() => {
entity.value = arrayData.store.data;
});
</script>

View File

@ -65,6 +65,7 @@ let salixUrl;
onMounted(async () => {
salixUrl = await getUrl(`claim/${entityId.value}`);
await arrayData.fetch({ append: false });
console.log('store', arrayData.store.data);
});
</script>
<template>

View File

@ -18,7 +18,7 @@ export const useArrayDataStore = defineStore('arrayDataStore', () => {
skip: 0,
order: '',
data: ref(),
isLoading: false
isLoading: false,
};
}