File tree Expand file tree Collapse file tree 4 files changed +16
-3
lines changed
Expand file tree Collapse file tree 4 files changed +16
-3
lines changed Original file line number Diff line number Diff line change @@ -13,6 +13,7 @@ import Enroll from '../components/enroll';
1313import urlFor from '../api' ;
1414import { ApiErrorData , isApiError } from 'shared/api/request' ;
1515import type { User , CoursesMap } from '../models' ;
16+ import { CourseData } from '../models/types' ;
1617
1718export class CourseEnrollment extends BaseModel {
1819
@@ -188,7 +189,7 @@ export class CourseEnrollment extends BaseModel {
188189 @action async create ( ) {
189190 if ( this . needsPeriodSelection ) {
190191 this . courseToJoin = new Course ( )
191- const courseData = await this . api . request (
192+ const courseData = await this . api . request < CourseData > (
192193 urlFor ( 'fetchEnrollmentChoices' , { enrollmentCode : this . originalEnrollmentCode } ) ,
193194 )
194195 this . courseToJoin = hydrateModel ( Course , courseData )
Original file line number Diff line number Diff line change @@ -325,7 +325,7 @@ export class Course extends BaseModel {
325325
326326 @action async saveExerciseExclusion ( { exercise, is_excluded } : { exercise : Exercise , is_excluded : boolean } ) {
327327 exercise . is_excluded = is_excluded ; // eagerly set exclusion
328- const data = await this . api . request (
328+ const data = await this . api . request < CourseData > (
329329 urlFor ( 'saveExerciseExclusion' , { courseId : this . id } ) ,
330330 { data : [ { id : exercise . id , is_excluded } ] } ,
331331 )
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import urlFor from '../../api'
55import type { Course } from '../../models'
66import Time from 'shared/model/time' ;
77import UiSettings from 'shared/model/ui-settings' ;
8+ import { CourseLMSData } from '../types' ;
89
910const LMS_VENDOR = 'lmsv' ;
1011
@@ -36,7 +37,7 @@ export class CourseLMS extends BaseModel {
3637 }
3738
3839 async fetch ( ) {
39- const json = await this . api . request ( urlFor ( 'fetchCourseLMS' , { courseId : this . course . id } ) )
40+ const json = await this . api . request < CourseLMSData > ( urlFor ( 'fetchCourseLMS' , { courseId : this . course . id } ) )
4041 hydrateInstance ( this , json )
4142 }
4243
Original file line number Diff line number Diff line change @@ -44,6 +44,17 @@ export interface TeacherProfileData {
4444 name : string
4545}
4646
47+ export interface CourseLMSData {
48+ id : ID
49+ key : string
50+ secret : string
51+ launch_url : string
52+ configuration_url : string
53+ xml : string
54+ created_at : string
55+ updated_at : string
56+ }
57+
4758export interface CoursePeriodData {
4859 id : ID
4960 enrollment_code : string
You can’t perform that action at this time.
0 commit comments