mirror of
https://github.com/HKUDS/DeepTutor.git
synced 2026-12-02 03:49:51 +08:00
32 lines
883 B
TypeScript
32 lines
883 B
TypeScript
import { apiFetch, apiUrl } from "@/lib/api";
|
|
|
|
export interface ReadingProgressRecord {
|
|
material_id: string;
|
|
latest_locator: number;
|
|
latest_percentage: number;
|
|
furthest_locator: number;
|
|
furthest_percentage: number;
|
|
updated_at: number;
|
|
}
|
|
|
|
export interface ReadingActivityRecord {
|
|
activity_id: string;
|
|
material_id: string;
|
|
extension_id: string;
|
|
action: string;
|
|
locator: number;
|
|
result_type: "card" | "quiz" | "feedback" | "browser_speech";
|
|
created_at: number;
|
|
}
|
|
|
|
export interface LearningRecords {
|
|
progress: ReadingProgressRecord[];
|
|
activities: ReadingActivityRecord[];
|
|
}
|
|
|
|
export async function listLearningRecords(): Promise<LearningRecords> {
|
|
const response = await apiFetch(apiUrl("/api/mastery-paths/reading/records"));
|
|
if (!response.ok) throw new Error("Failed to load learning progress");
|
|
return response.json() as Promise<LearningRecords>;
|
|
}
|