File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -59,6 +59,17 @@ export async function getCourseOutlineIndex(courseId) {
59
59
return camelCaseObject ( data ) ;
60
60
}
61
61
62
+ /**
63
+ *
64
+ * @param courseId
65
+ * @returns {Promise<Array|Object> }
66
+ */
67
+ export async function createDiscussionsTopics ( courseId ) {
68
+ const { data } = await getAuthenticatedHttpClient ( )
69
+ . post ( `${ getApiBaseUrl ( ) } /api/discussions/v0/course/${ courseId } /sync_discussion_topics` ) ;
70
+ return camelCaseObject ( data ) ;
71
+ }
72
+
62
73
/**
63
74
* Get course best practices.
64
75
* @param {{courseId: string, excludeGraded: boolean, all: boolean} } options
Original file line number Diff line number Diff line change @@ -30,7 +30,7 @@ import {
30
30
setVideoSharingOption ,
31
31
setCourseItemOrderList ,
32
32
pasteBlock ,
33
- dismissNotification ,
33
+ dismissNotification , createDiscussionsTopics ,
34
34
} from './api' ;
35
35
import {
36
36
addSection ,
@@ -92,6 +92,12 @@ export function fetchCourseOutlineIndexQuery(courseId) {
92
92
} ) ) ;
93
93
}
94
94
}
95
+ // Sync discussions topics and log errors if any because we don't want to interrupt the process.
96
+ try {
97
+ await createDiscussionsTopics ( courseId ) ;
98
+ } catch ( error ) {
99
+ console . log ( error ) ;
100
+ }
95
101
} ;
96
102
}
97
103
You can’t perform that action at this time.
0 commit comments