Add difficulty param to leaderboard, per-difficulty completion status
This commit is contained in:
+10
-3
@@ -43,9 +43,10 @@ export async function getLeaderboard(
|
||||
period: 'daily' | 'weekly' | 'all-time' = 'daily',
|
||||
page = 1,
|
||||
limit = 20,
|
||||
difficulty?: string,
|
||||
): Promise<LeaderboardResponse> {
|
||||
const { data } = await apiClient.get<LeaderboardResponse>('/leaderboards', {
|
||||
params: { period, page, limit },
|
||||
params: { period, page, limit, ...(difficulty && { difficulty }) },
|
||||
});
|
||||
return data;
|
||||
}
|
||||
@@ -57,8 +58,14 @@ export async function getUserStats(mode: 'all' | 'daily' = 'daily'): Promise<Use
|
||||
return data;
|
||||
}
|
||||
|
||||
export async function checkDailyCompletion(): Promise<{ completed: boolean }> {
|
||||
const { data } = await apiClient.get<{ completed: boolean }>('/leaderboards/me/today');
|
||||
export interface DailyCompletionStatus {
|
||||
easy: boolean;
|
||||
medium: boolean;
|
||||
hard: boolean;
|
||||
}
|
||||
|
||||
export async function checkDailyCompletion(): Promise<DailyCompletionStatus> {
|
||||
const { data } = await apiClient.get<DailyCompletionStatus>('/leaderboards/me/today');
|
||||
return data;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user