Integrate project classroom with teacher and friend consultations
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
import { hostApiFetch, createHostEventSource, ensureHostApiToken } from './host-api';
|
||||
import type {
|
||||
ConsultationRole,
|
||||
TeacherAvailability,
|
||||
TeacherDefinition,
|
||||
TeacherSend,
|
||||
TeacherTopic,
|
||||
TeacherTopicList,
|
||||
} from '../../shared/coding-teacher';
|
||||
export function teacherTopicsPath(projectId: string, sourceId: string) {
|
||||
export function teacherTopicsPath(projectId: string, sourceId: string, role?: ConsultationRole) {
|
||||
if (role && projectId !== 'preview') return `/api/coding/projects/${encodeURIComponent(projectId)}/${role}-topics`;
|
||||
return projectId === 'preview'
|
||||
? '/api/coding/teacher-preview/topics'
|
||||
: `/api/coding/projects/${encodeURIComponent(projectId)}/conversations/${encodeURIComponent(sourceId)}/teacher-topics`;
|
||||
}
|
||||
export const teacherApi = {
|
||||
config: () =>
|
||||
config: (role: ConsultationRole = 'teacher') =>
|
||||
hostApiFetch<TeacherAvailability & { definition: TeacherDefinition | null }>(
|
||||
'/api/coding/teacher/config'
|
||||
`/api/coding/${role}/config`
|
||||
),
|
||||
preview: (draftRevision: number) =>
|
||||
hostApiFetch<{ payload: TeacherDefinition; draft_revision: number }>(
|
||||
|
||||
Reference in New Issue
Block a user