Route analytics access through composable
This commit is contained in:
1 parent
105efc40d5
commit
b6f8d6df18
4 files changed
+21
-8
No files matched your search
@@ -430,11 +430,10 @@ import {
|
||||
} from 'lucide-vue-next'
|
||||
import StatCard from '@/components/common/StatCard.vue'
|
||||
import SmoothTrendCanvas from '@/components/common/SmoothTrendCanvas.vue'
|
||||
import { useDashboardStats, useInjectedDarkMode } from '@/composables'
|
||||
import { useDashboardStats, useInjectedDarkMode, useTransferAnalytics } from '@/composables'
|
||||
import { useI18n } from 'vue-i18n'
|
||||
import { ROUTES } from '@/constants'
|
||||
import { useConfigStore } from '@/stores/configStore'
|
||||
import { StatsService } from '@/services'
|
||||
import { formatFileSize } from '@/utils/common'
|
||||
import type { AnalyticsData, AnalyticsFileRow, DashboardHealthAction } from '@/types'
|
||||
|
||||
@@ -447,6 +446,7 @@ const { dashboardData, errorMessage, fetchDashboardData, isLoading, lastUpdatedT
|
||||
useDashboardStats({
|
||||
loadFailedMessage: t('admin.dashboard.loadFailed')
|
||||
})
|
||||
const { fetchAnalytics } = useTransferAnalytics()
|
||||
|
||||
const primaryTextClass = computed(() => (isDarkMode.value ? 'text-white' : 'text-gray-900'))
|
||||
const mutedTextClass = computed(() => (isDarkMode.value ? 'text-gray-400' : 'text-gray-500'))
|
||||
@@ -503,8 +503,7 @@ const formatBytes = (value: number | string | undefined) => formatFileSize(Numbe
|
||||
const fetchAnalyticsData = async () => {
|
||||
analyticsError.value = ''
|
||||
try {
|
||||
const response = await StatsService.getAnalytics(analyticsStart.value, analyticsEnd.value)
|
||||
analyticsData.value = response.detail || null
|
||||
analyticsData.value = await fetchAnalytics(analyticsStart.value, analyticsEnd.value)
|
||||
} catch (error) {
|
||||
analyticsError.value = error instanceof Error ? error.message : '统计加载失败'
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user