Basic discussions forum framework
Adds the basic structure for the Discussions MFE around which future development will happen.
This commit is contained in:
17
src/discussions/posts/data/thunks.js
Normal file
17
src/discussions/posts/data/thunks.js
Normal file
@@ -0,0 +1,17 @@
|
||||
/* eslint-disable import/prefer-default-export */
|
||||
import { logError } from '@edx/frontend-platform/logging';
|
||||
import { getCourseThreads } from './api';
|
||||
import { fetchCourseThreadsFailed, fetchCourseThreadsRequest, fetchCourseThreadsSuccess } from './slices';
|
||||
|
||||
export function fetchCourseThreads(courseId, topicIds) {
|
||||
return async (dispatch) => {
|
||||
try {
|
||||
dispatch(fetchCourseThreadsRequest({ courseId }));
|
||||
const data = await getCourseThreads(courseId, topicIds);
|
||||
dispatch(fetchCourseThreadsSuccess(data));
|
||||
} catch (error) {
|
||||
dispatch(fetchCourseThreadsFailed());
|
||||
logError(error);
|
||||
}
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user