DocDoeAI / src /lib /api /teaching-preferences.ts
asnannp's picture
deploy: sync backend to Space root (learn-lesson HF cache fix)
f3056f5
Raw History Blame Contribute Delete
574 Bytes
import { apiFetch } from "./client";
export type TeachingPace = "standard" | "step_by_step" | "full_section";
export function readTeachingPace(preferences: Record<string, unknown> | undefined): TeachingPace {
const pace = preferences?.teaching_pace;
return pace === "step_by_step" || pace === "full_section" ? pace : "standard";
}
export function saveTeachingPace(teaching_pace: TeachingPace): Promise<{ teaching_pace: TeachingPace }> {
return apiFetch("/learning-state/teaching-preferences", {
method: "PATCH", body: JSON.stringify({ teaching_pace }),
});
}