fix: [AA-1206] resolve access APIs (#838)

* fix: [AA-1206] resolve access APIs

As part of eliminating redundant fields course_access was removed from
 the Courseware metadata API. There are some differences between the
 two APIs - courseware returned an error if the course had flags
 preventing it from being loaded in the MFE, and courseHome had a
 second field, can_load_courseware, that returned a boolean.

 This fix unifies the handling of the access fields to behave consistently.
This commit is contained in:
Chris Deery
2022-03-03 16:12:14 -05:00
committed by GitHub
parent 4586f8a6ad
commit 55dac2696e
6 changed files with 34 additions and 24 deletions

View File

@@ -93,7 +93,9 @@ export function fetchCourse(courseId) {
logError(courseHomeMetadataResult.reason);
}
if (fetchedMetadata && fetchedCourseHomeMetadata) {
if (courseHomeMetadataResult.value.courseAccess.hasAccess && fetchedOutline) {
if (courseHomeMetadataResult.value.courseAccess.hasAccess
&& courseHomeMetadataResult.value.canLoadCourseware
&& fetchedOutline) {
// User has access
dispatch(fetchCourseSuccess({ courseId }));
return;