Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 | import { ref } from 'vue' import { dashboardApi } from '@/api/dashboard.api' // ---------------------------------------------------------------- // USE DASHBOARD COMPOSABLE // ---------------------------------------------------------------- export const useDashboard = () => { const stats = ref({ deployments: 0, apps: 0, courses: 0, loading: true }) const fetchStats = async () => { stats.value.loading = true try { const { data } = await dashboardApi.stats() stats.value.deployments = data.deployments stats.value.apps = data.apps stats.value.courses = data.courses } catch (err) { console.error("Dashboard stats error:", err) throw err } finally { stats.value.loading = false } } return { stats, fetchStats } } |