Add basic dates tab (#62)

This is not the final visuals for the dates tab, but an in-progress
page to base further work on.

AA-116
This commit is contained in:
Michael Terry
2020-05-26 13:07:24 -04:00
committed by GitHub
parent e101b41c08
commit 7487d8d32f
12 changed files with 262 additions and 5 deletions

View File

@@ -3,6 +3,9 @@ import { getConfig, camelCaseObject } from '@edx/frontend-platform';
import { getAuthenticatedHttpClient, getAuthenticatedUser } from '@edx/frontend-platform/auth';
import { logError } from '@edx/frontend-platform/logging';
// FIXME: remove this WIP hack once we're done developing the tab
import datesTabData from './dates';
function overrideTabUrls(id, tabs) {
// "LMS tab slug" to "MFE URL slug" for overridden tabs
const tabOverrides = {};
@@ -49,6 +52,16 @@ export async function getCourseMetadata(courseId) {
return normalizeMetadata(data);
}
export async function getTabData(courseId, tab, version) {
if (tab === 'dates') {
return camelCaseObject(datesTabData());
}
const url = `${getConfig().LMS_BASE_URL}/course/${courseId}/api/course_home/${version}/${tab}`;
const { data } = await getAuthenticatedHttpClient().get(url);
return camelCaseObject(data);
}
function normalizeBlocks(courseId, blocks) {
const models = {
courses: {},