Add stats

This commit is contained in:
2026-05-31 08:41:53 +02:00
parent bd8d1b1936
commit 7d9c22d5d3
14 changed files with 304 additions and 16 deletions
+6 -1
View File
@@ -5,7 +5,8 @@ import type {
SessionListResponse,
DailySummaryResponse,
TimetableResponse,
WakeupBedtimeResponse
WakeupBedtimeResponse,
SummaryResponse
} from '@/types';
const BASE_URL = import.meta.env.VITE_API_BASE_URL || '';
@@ -39,6 +40,10 @@ async function fetchStats<T>(endpoint: string, from_date: string, to_date: strin
return response.json();
}
export async function fetchSummary(from_date: string, to_date: string): Promise<SummaryResponse> {
return fetchStats('summary', from_date, to_date);
}
export async function fetchDailySummary(from_date: string, to_date: string, day_start: string, day_end: string): Promise<DailySummaryResponse> {
return fetchStats('daily-summary', from_date, to_date, { day_start, day_end });
}