Compare commits
2 Commits
dependabot
...
AA-820b
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ffe10e56f5 | ||
|
|
15027ab69e |
@@ -211,8 +211,11 @@ export async function getDatesTabData(courseId) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function getProgressTabData(courseId) {
|
export async function getProgressTabData(courseId, userId) {
|
||||||
const url = `${getConfig().LMS_BASE_URL}/api/course_home/v1/progress/${courseId}`;
|
let url = `${getConfig().LMS_BASE_URL}/api/course_home/v1/progress/${courseId}`;
|
||||||
|
if (userId) {
|
||||||
|
url += `/${userId}/`;
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
const { data } = await getAuthenticatedHttpClient().get(url);
|
const { data } = await getAuthenticatedHttpClient().get(url);
|
||||||
const camelCasedData = camelCaseObject(data);
|
const camelCasedData = camelCaseObject(data);
|
||||||
|
|||||||
@@ -27,12 +27,12 @@ const eventTypes = {
|
|||||||
POST_EVENT: 'post_event',
|
POST_EVENT: 'post_event',
|
||||||
};
|
};
|
||||||
|
|
||||||
export function fetchTab(courseId, tab, getTabData) {
|
export function fetchTab(courseId, tab, getTabData, userId) {
|
||||||
return async (dispatch) => {
|
return async (dispatch) => {
|
||||||
dispatch(fetchTabRequest({ courseId }));
|
dispatch(fetchTabRequest({ courseId }));
|
||||||
Promise.allSettled([
|
Promise.allSettled([
|
||||||
getCourseHomeCourseMetadata(courseId),
|
getCourseHomeCourseMetadata(courseId),
|
||||||
getTabData(courseId),
|
getTabData(courseId, userId),
|
||||||
]).then(([courseHomeCourseMetadataResult, tabDataResult]) => {
|
]).then(([courseHomeCourseMetadataResult, tabDataResult]) => {
|
||||||
const fetchedCourseHomeCourseMetadata = courseHomeCourseMetadataResult.status === 'fulfilled';
|
const fetchedCourseHomeCourseMetadata = courseHomeCourseMetadataResult.status === 'fulfilled';
|
||||||
const fetchedTabData = tabDataResult.status === 'fulfilled';
|
const fetchedTabData = tabDataResult.status === 'fulfilled';
|
||||||
@@ -74,8 +74,8 @@ export function fetchDatesTab(courseId) {
|
|||||||
return fetchTab(courseId, 'dates', getDatesTabData);
|
return fetchTab(courseId, 'dates', getDatesTabData);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchProgressTab(courseId) {
|
export function fetchProgressTab(courseId, userId) {
|
||||||
return fetchTab(courseId, 'progress', getProgressTabData);
|
return fetchTab(courseId, 'progress', getProgressTabData, userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
export function fetchOutlineTab(courseId) {
|
export function fetchOutlineTab(courseId) {
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ function OutlineTab({ intl }) {
|
|||||||
</div>
|
</div>
|
||||||
{resumeCourseUrl && (
|
{resumeCourseUrl && (
|
||||||
<div className="col-12 col-sm-auto p-0">
|
<div className="col-12 col-sm-auto p-0">
|
||||||
<Button block href={resumeCourseUrl} onClick={() => logResumeCourseClick()}>
|
<Button variant="brand" block href={resumeCourseUrl} onClick={() => logResumeCourseClick()}>
|
||||||
{hasVisitedCourse ? intl.formatMessage(messages.resume) : intl.formatMessage(messages.start)}
|
{hasVisitedCourse ? intl.formatMessage(messages.resume) : intl.formatMessage(messages.start)}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -44,7 +44,12 @@ subscribe(APP_READY, () => {
|
|||||||
<DatesTab />
|
<DatesTab />
|
||||||
</TabContainer>
|
</TabContainer>
|
||||||
</PageRoute>
|
</PageRoute>
|
||||||
<PageRoute path="/course/:courseId/progress">
|
<PageRoute
|
||||||
|
path={[
|
||||||
|
'/course/:courseId/progress/:userId/',
|
||||||
|
'/course/:courseId/progress',
|
||||||
|
]}
|
||||||
|
>
|
||||||
<TabContainer tab="progress" fetch={fetchProgressTab} slice="courseHome">
|
<TabContainer tab="progress" fetch={fetchProgressTab} slice="courseHome">
|
||||||
<ProgressTab />
|
<ProgressTab />
|
||||||
</TabContainer>
|
</TabContainer>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ export default function TabContainer(props) {
|
|||||||
tab,
|
tab,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
const { courseId: courseIdFromUrl } = useParams();
|
const { courseId: courseIdFromUrl, userId } = useParams();
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// The courseId from the URL is the course we WANT to load.
|
// The courseId from the URL is the course we WANT to load.
|
||||||
@@ -31,6 +31,7 @@ export default function TabContainer(props) {
|
|||||||
<TabPage
|
<TabPage
|
||||||
activeTabSlug={tab}
|
activeTabSlug={tab}
|
||||||
courseId={courseId}
|
courseId={courseId}
|
||||||
|
userId={userId}
|
||||||
courseStatus={courseStatus}
|
courseStatus={courseStatus}
|
||||||
metadataModel={`${slice}Meta`}
|
metadataModel={`${slice}Meta`}
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user