@innertia-solutions/nuxt-theme-spark 0.1.120 → 0.1.121
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,21 +3,27 @@ const props = defineProps({
|
|
|
3
3
|
endpoint: { type: String, required: true },
|
|
4
4
|
})
|
|
5
5
|
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const api = useApi()
|
|
7
|
+
const events = ref([])
|
|
8
|
+
const pending = ref(false)
|
|
9
|
+
const error = ref(null)
|
|
8
10
|
|
|
9
|
-
const
|
|
11
|
+
const fetchHistory = async () => {
|
|
12
|
+
pending.value = true
|
|
13
|
+
error.value = null
|
|
14
|
+
try {
|
|
15
|
+
const data = await api.get(props.endpoint)
|
|
16
|
+
events.value = Array.isArray(data) ? data : (data.data ?? [])
|
|
17
|
+
} catch (e) {
|
|
18
|
+
error.value = e
|
|
19
|
+
} finally {
|
|
20
|
+
pending.value = false
|
|
21
|
+
}
|
|
22
|
+
}
|
|
10
23
|
|
|
11
|
-
const
|
|
12
|
-
watch: [url],
|
|
13
|
-
key: computed(() => `timeline-${props.endpoint}`),
|
|
14
|
-
})
|
|
24
|
+
const refresh = fetchHistory
|
|
15
25
|
|
|
16
|
-
|
|
17
|
-
const d = rawData.value
|
|
18
|
-
if (!d) return []
|
|
19
|
-
return Array.isArray(d) ? d : (d.data ?? [])
|
|
20
|
-
})
|
|
26
|
+
watch(() => props.endpoint, fetchHistory, { immediate: true })
|
|
21
27
|
|
|
22
28
|
const typeConfig = {
|
|
23
29
|
created: { color: 'bg-green-500', label: 'Creado', textColor: 'text-green-600 dark:text-green-400' },
|