Skip to content

Commit

Permalink
Merge branch 'develop/nutmeg.master' into feature.nutmeg/badges
Browse files Browse the repository at this point in the history
  • Loading branch information
becdavid authored Jan 19, 2024
2 parents 2cab667 + a141601 commit e1a0585
Show file tree
Hide file tree
Showing 11 changed files with 1,685 additions and 318 deletions.
1,424 changes: 1,106 additions & 318 deletions package-lock.json

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@
"axios-mock-adapter": "1.20.0",
"codecov": "3.8.3",
"es-check": "6.2.1",
"eslint-plugin-jsx-a11y": "^6.7.1",
"husky": "7.0.4",
"jest": "27.5.1",
"rosie": "2.1.0"
Expand Down
34 changes: 34 additions & 0 deletions src/course-home/data/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,40 @@ export async function getProgressTabData(courseId, targetUserId) {
}
}

export async function getGlossaryTabData(courseId) {
const url = `${getConfig().LMS_BASE_URL}/api/course_home/glossary/${courseId}`;
try {
const { data } = await getAuthenticatedHttpClient().get(url);
return camelCaseObject(data);
} catch (error) {
const { httpErrorStatus } = error && error.customAttributes;
if (httpErrorStatus === 404) {
global.location.replace(`${getConfig().LMS_BASE_URL}/courses/${courseId}/glossary`);
return {};
}
if (httpErrorStatus === 401) {
// The backend sends this for unenrolled and unauthenticated learners, but we handle those cases by examining
// courseAccess in the metadata call, so just ignore this status for now.
return {};
}
throw error;
}
}

export async function getGlossaryData(courseId) {
const url = `${process.env.KEYTERMS_API_BASE_URL}/api/v1/course_terms?course_id=${courseId}`;
try {
const { data } = await getAuthenticatedHttpClient().get(url);
return data;
} catch (error) {
const { httpErrorStatus } = error && error.customAttributes;
if (httpErrorStatus === 404) {
return {};
}
throw error;
}
}

export async function getProctoringInfoData(courseId, username) {
let url = `${getConfig().LMS_BASE_URL}/api/edx_proctoring/v1/user_onboarding/status?is_learning_mfe=true&course_id=${encodeURIComponent(courseId)}`;
if (username) {
Expand Down
1 change: 1 addition & 0 deletions src/course-home/data/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export {
fetchDatesTab,
fetchOutlineTab,
fetchProgressTab,
fetchGlossaryTab,
resetDeadlines,
deprecatedSaveCourseGoal,
saveWeeklyLearningGoal,
Expand Down
5 changes: 5 additions & 0 deletions src/course-home/data/thunks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
getDatesTabData,
getOutlineTabData,
getProgressTabData,
getGlossaryTabData,
postCourseDeadlines,
deprecatedPostCourseGoals,
postWeeklyLearningGoal,
Expand Down Expand Up @@ -96,6 +97,10 @@ export function fetchProgressTab(courseId, targetUserId) {
return fetchTab(courseId, 'progress', getProgressTabData, parseInt(targetUserId, 10) || targetUserId);
}

export function fetchGlossaryTab(courseId) {
return fetchTab(courseId, 'glossary', getGlossaryTabData);
}

export function fetchOutlineTab(courseId) {
return fetchTab(courseId, 'outline', getOutlineTabData);
}
Expand Down
Loading

0 comments on commit e1a0585

Please sign in to comment.