mirror of
https://github.com/Awuqing/BackupX.git
synced 2026-07-09 06:22:42 +08:00
first commit
This commit is contained in:
12
web/src/services/dashboard.ts
Normal file
12
web/src/services/dashboard.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
import { http, type ApiEnvelope, unwrapApiEnvelope } from './http'
|
||||
import type { BackupTimelinePoint, DashboardStats } from '../types/dashboard'
|
||||
|
||||
export async function fetchDashboardStats() {
|
||||
const response = await http.get<ApiEnvelope<DashboardStats>>('/dashboard/stats')
|
||||
return unwrapApiEnvelope(response.data)
|
||||
}
|
||||
|
||||
export async function fetchDashboardTimeline(days = 30) {
|
||||
const response = await http.get<ApiEnvelope<BackupTimelinePoint[]>>('/dashboard/timeline', { params: { days } })
|
||||
return unwrapApiEnvelope(response.data)
|
||||
}
|
||||
Reference in New Issue
Block a user