(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
27 lines
808 B
JavaScript
27 lines
808 B
JavaScript
/* eslint-disable import/prefer-default-export */
|
|
import { getAuthenticatedHttpClient } from '@edx/frontend-platform/auth';
|
|
|
|
import { getApiBaseUrl } from '../../../data/constants';
|
|
|
|
export async function getCourseTopics(courseId, topicIds) {
|
|
const url = `${getApiBaseUrl()}/api/discussion/v1/course_topics/${courseId}`;
|
|
const params = {};
|
|
if (topicIds) {
|
|
params.topic_id = topicIds.join(',');
|
|
}
|
|
const { data } = await getAuthenticatedHttpClient()
|
|
.get(url);
|
|
return data;
|
|
}
|
|
|
|
export async function getCourseTopicsV2(courseId, topicIds) {
|
|
const url = `${getApiBaseUrl()}/api/discussion/v2/course_topics/${courseId}`;
|
|
const params = {};
|
|
if (topicIds) {
|
|
params.topic_id = topicIds.join(',');
|
|
}
|
|
const { data } = await getAuthenticatedHttpClient()
|
|
.get(url);
|
|
return data;
|
|
}
|