Files
frontend-app-authoring/src/index.jsx
Kshitij Sobti 0e7340bdda feat: Hook up course apps API and add base components for app configuration
Hooks up the course apps API so that the data returned by the server is being used.
Adds the base components and infrastructure to enable adding pages for configuring
each app.
2021-07-01 20:58:05 +05:00

58 lines
1.5 KiB
JavaScript
Executable File

import 'core-js/stable';
import 'regenerator-runtime/runtime';
import {
APP_INIT_ERROR, APP_READY, subscribe, initialize, mergeConfig,
} from '@edx/frontend-platform';
import { AppProvider, ErrorPage } from '@edx/frontend-platform/react';
import React from 'react';
import ReactDOM from 'react-dom';
import { Route, Switch } from 'react-router-dom';
import { messages as footerMessages } from '@edx/frontend-component-footer';
import appMessages from './i18n';
import initializeStore from './store';
import './index.scss';
import CourseAuthoringRoutes from './CourseAuthoringRoutes';
subscribe(APP_READY, () => {
ReactDOM.render(
<AppProvider store={initializeStore()}>
<Switch>
<Route
path="/course/:courseId"
render={({ match }) => {
const { params: { courseId } } = match;
return (
<CourseAuthoringRoutes courseId={courseId} />
);
}}
/>
</Switch>
</AppProvider>,
document.getElementById('root'),
);
});
subscribe(APP_INIT_ERROR, (error) => {
ReactDOM.render(<ErrorPage message={error.message} />, document.getElementById('root'));
});
initialize({
handlers: {
config: () => {
mergeConfig({
SUPPORT_URL: process.env.SUPPORT_URL || null,
CALCULATOR_HELP_URL: process.env.CALCULATOR_HELP_URL || null,
}, 'CourseAuthoringConfig');
},
},
messages: [
appMessages,
footerMessages,
],
requireAuthenticatedUser: true,
});