feat: network actions
This commit is contained in:
@@ -1,4 +1,9 @@
|
||||
import { get } from './utils';
|
||||
import {
|
||||
client,
|
||||
get,
|
||||
post,
|
||||
stringifyUrl,
|
||||
} from './utils';
|
||||
import urls from './urls';
|
||||
|
||||
/*********************************************************************************
|
||||
@@ -6,4 +11,18 @@ import urls from './urls';
|
||||
*********************************************************************************/
|
||||
const initializeList = () => get(urls.init).then(({ data }) => data);
|
||||
|
||||
export default { initializeList };
|
||||
const updateEntitlementEnrollment = ({ uuid, courseId }) => post(stringifyUrl(
|
||||
urls.entitlementEnrollment(uuid),
|
||||
{ course_run_id: courseId },
|
||||
));
|
||||
|
||||
const deleteEntitlementEnrollment = ({ uuid }) => client().delete(stringifyUrl(
|
||||
urls.entitlementEnrollment(uuid),
|
||||
{ course_run_id: null },
|
||||
));
|
||||
|
||||
export default {
|
||||
initializeList,
|
||||
updateEntitlementEnrollment,
|
||||
deleteEntitlementEnrollment,
|
||||
};
|
||||
|
||||
@@ -60,13 +60,7 @@ const globalData = {
|
||||
isNeeded: true,
|
||||
sendEmailUrl: 'sendConfirmation@edx.org',
|
||||
},
|
||||
enterpriseDashboards: {
|
||||
availableDashboards: [
|
||||
{ label: 'edX, Inc.', url: '/edx-dashboard' },
|
||||
{ label: 'Harvard', url: '/harvard-dashboard' },
|
||||
],
|
||||
mostRecentDashboard: { label: 'edX, Inc.', url: '/edx-dashboard' },
|
||||
},
|
||||
enterpriseDashboard: { label: 'edX, Inc.', url: '/edx-dashboard' },
|
||||
platformSettings: {
|
||||
supportEmail: 'support@example.com',
|
||||
billingEmail: 'billing@email.com',
|
||||
@@ -689,13 +683,6 @@ export const entitlementData = entitlementCourses.map(
|
||||
},
|
||||
);
|
||||
|
||||
console.log({
|
||||
networkData: {
|
||||
courses: [...courseRunData, ...entitlementData],
|
||||
...globalData,
|
||||
},
|
||||
});
|
||||
|
||||
export default {
|
||||
courseRunData,
|
||||
entitlementData,
|
||||
|
||||
@@ -6,7 +6,10 @@ const baseUrl = `${configuration.LMS_BASE_URL}`;
|
||||
const api = `${baseUrl}/api/`;
|
||||
const init = `${api}learner_home/mock/init`;
|
||||
|
||||
const entitlementEnrollment = (uuid) => `${api}/entitlements/v1/entitlements/${uuid}/enrollments`;
|
||||
|
||||
export default StrictDict({
|
||||
api,
|
||||
init,
|
||||
entitlementEnrollment,
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user