@innertia-solutions/nuxt-theme-spark 0.1.83 → 0.1.85
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.
- package/components/Table.vue +8 -5
- package/package.json +1 -1
package/components/Table.vue
CHANGED
|
@@ -154,7 +154,7 @@ const fetchData = async () => {
|
|
|
154
154
|
isDataFromCache.value = false
|
|
155
155
|
|
|
156
156
|
try {
|
|
157
|
-
const res = await api.
|
|
157
|
+
const res = await api.get(props.endpoint, { params: buildRequestParams() })
|
|
158
158
|
if (!res) return
|
|
159
159
|
|
|
160
160
|
tableData.value = Array.isArray(res.data) ? res.data : (Array.isArray(res) ? res : [])
|
|
@@ -178,9 +178,12 @@ const scheduleFetch = (delay = 0) => {
|
|
|
178
178
|
}
|
|
179
179
|
|
|
180
180
|
// ─── Cache ────────────────────────────────────────────────────────────────────
|
|
181
|
-
const cacheKey = computed(() =>
|
|
182
|
-
props.cached
|
|
183
|
-
|
|
181
|
+
const cacheKey = computed(() => {
|
|
182
|
+
if (!props.cached || !props.name) return null
|
|
183
|
+
const base = `full_table_${props.name}`
|
|
184
|
+
if (!Object.keys(props.params).length) return base
|
|
185
|
+
try { return base + '_' + btoa(JSON.stringify(props.params)) } catch { return base }
|
|
186
|
+
})
|
|
184
187
|
|
|
185
188
|
const saveToCache = () => {
|
|
186
189
|
if (!cacheKey.value || !tableData.value.length) return
|
|
@@ -389,7 +392,7 @@ const exportTable = async (format, exportAllPages, exportFilteredRows, selectedI
|
|
|
389
392
|
|
|
390
393
|
try {
|
|
391
394
|
const { blob, headers } = await download(props.endpoint, params, {
|
|
392
|
-
method: '
|
|
395
|
+
method: 'GET',
|
|
393
396
|
onProgress: (p) => toast.update(id, { progress: p, progressLabel: `Descargando... ${p}%` }),
|
|
394
397
|
})
|
|
395
398
|
|