feat: Support runtime configuration (second attempt)

(This reintroduces the change in 9f84230c that was later reverted by
67b0b33a.)

frontend-platform supports runtime configuration since 2.5.0 (see the PR
that introduced it[1], but it requires MFE cooperation.  This implements
just that: by avoiding making configuration values constant, it should
now be possible to change them after initialization.

Almost all changes here relate to the `LMS_BASE_URL` setting, which in
most places was treated as a constant.

[1] https://github.com/openedx/frontend-platform/pull/335
This commit is contained in:
Adolfo R. Brandes
2022-12-07 19:15:51 -03:00
committed by Mehak Nasir
parent 49d6fbed3c
commit 0c71e8b5b7
27 changed files with 86 additions and 76 deletions

View File

@@ -1,10 +1,10 @@
/* eslint-disable import/prefer-default-export */
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
import { API_BASE_URL } from '../../../data/constants';
import { getApiBaseUrl } from '../../../data/constants';
export async function getCourseTopics(courseId, topicIds) {
const url = `${API_BASE_URL}/api/discussion/v1/course_topics/${courseId}`;
const url = `${getApiBaseUrl()}/api/discussion/v1/course_topics/${courseId}`;
const params = {};
if (topicIds) {
params.topic_id = topicIds.join(',');
@@ -15,7 +15,7 @@ export async function getCourseTopics(courseId, topicIds) {
}
export async function getCourseTopicsV2(courseId, topicIds) {
const url = `${API_BASE_URL}/api/discussion/v2/course_topics/${courseId}`;
const url = `${getApiBaseUrl()}/api/discussion/v2/course_topics/${courseId}`;
const params = {};
if (topicIds) {
params.topic_id = topicIds.join(',');