rapid interations of server side app and firefox extension

This commit is contained in:
Bryan Van Deusen
2026-01-24 22:52:51 -05:00
commit b9b8048a2d
81 changed files with 9675 additions and 0 deletions
+50
View File
@@ -0,0 +1,50 @@
import { defineStore } from 'pinia'
import { ref } from 'vue'
import { downloadsApi } from '../services/api'
export const useDownloadsStore = defineStore('downloads', () => {
const downloads = ref([])
const stats = ref(null)
const loading = ref(false)
const total = ref(0)
const currentPage = ref(1)
const perPage = ref(20)
async function fetchDownloads(params = {}) {
loading.value = true
try {
const response = await downloadsApi.list({
page: currentPage.value,
per_page: perPage.value,
...params,
})
downloads.value = response.data.items
total.value = response.data.total
return response.data
} finally {
loading.value = false
}
}
async function fetchStats(params = {}) {
const response = await downloadsApi.stats(params)
stats.value = response.data
return response.data
}
async function retryDownload(id) {
return await downloadsApi.retry(id)
}
return {
downloads,
stats,
loading,
total,
currentPage,
perPage,
fetchDownloads,
fetchStats,
retryDownload,
}
})