Add stats
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user