mirror of
https://github.com/pupperpowell/bibdle.git
synced 2026-04-05 17:33:31 -04:00
Added streak percentage
This commit is contained in:
@@ -5,3 +5,11 @@ export async function fetchStreak(anonymousId: string, localDate: string): Promi
|
||||
const data = await res.json();
|
||||
return typeof data.streak === 'number' ? data.streak : 0;
|
||||
}
|
||||
|
||||
export async function fetchStreakPercentile(streak: number, localDate: string): Promise<number | null> {
|
||||
const params = new URLSearchParams({ streak: String(streak), localDate });
|
||||
const res = await fetch(`/api/streak-percentile?${params}`);
|
||||
if (!res.ok) return null;
|
||||
const data = await res.json();
|
||||
return typeof data.percentile === 'number' ? data.percentile : null;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user