fix(teacher): 独立刷新老师目录以缩短配置更新延迟
This commit is contained in:
1 parent
2767a15017
commit
913ccad577
9 files changed
+184
-7
No files matched your search
@@ -73,6 +73,11 @@ export const teacherAvailability = (account: TeacherAccount) =>
|
||||
teacherCloudRequest<TeacherAvailability>(account, '/api/coding-teacher/config');
|
||||
export const teacherCatalog = (account: TeacherAccount) =>
|
||||
teacherCloudRequest<TeacherCatalog>(account, '/api/coding-teacher/teachers');
|
||||
export async function teacherCatalogRevision(): Promise<{ revision: number }> {
|
||||
const binding = getWorksSquareAccountBinding();
|
||||
if (!binding) throw new TeacherError(401, 'teacher_auth_required', '请先登录。');
|
||||
return teacherCloudRequest({ id: '', binding }, '/api/coding-teacher/teachers/revision');
|
||||
}
|
||||
export const teacherVersion = (account: TeacherAccount, version: number) =>
|
||||
teacherCloudRequest<{ version: number; payload: TeacherDefinition }>(
|
||||
account,
|
||||
|
||||
@@ -24,6 +24,7 @@ import {
|
||||
teacherVersion,
|
||||
teacherPreview,
|
||||
teacherCatalog,
|
||||
teacherCatalogRevision,
|
||||
TeacherError,
|
||||
type TeacherAccount,
|
||||
} from './config-client';
|
||||
@@ -103,6 +104,10 @@ export class CodingTeacherService {
|
||||
async catalog() {
|
||||
return (this.options.catalog ?? teacherCatalog)(await this.account());
|
||||
}
|
||||
|
||||
async catalogRevision() {
|
||||
return teacherCatalogRevision();
|
||||
}
|
||||
async legacyHistory(projectId: string, selection?: { id: string; sourceId: string; friend: boolean }) {
|
||||
const account = await this.account();
|
||||
const project = await this.options.projects.getProject(projectId);
|
||||
|
||||
Reference in new issue
Block a user