Skip to content

Commit 9966ef5

Browse files
authored
refactor: Replace usages enterprise_catalog Enterprise API V1 (#801)
1 parent 001722f commit 9966ef5

File tree

3 files changed

+8
-7
lines changed

3 files changed

+8
-7
lines changed

src/components/ReportingConfig/index.jsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import PropTypes from 'prop-types';
33
import { Collapsible, Icon } from '@edx/paragon';
44
import { camelCaseObject } from '@edx/frontend-platform';
5+
import EnterpriseCatalogApiService from '../../data/services/EnterpriseCatalogApiService';
56
import LMSApiService from '../../data/services/LmsApiService';
67
import ReportingConfigForm from './ReportingConfigForm';
78
import { snakeCaseFormData } from '../../utils';
@@ -26,7 +27,7 @@ class ReportingConfig extends React.Component {
2627
componentDidMount() {
2728
Promise.allSettled([
2829
LMSApiService.fetchReportingConfigs(this.props.enterpriseId),
29-
LMSApiService.fetchEnterpriseCustomerCatalogs(this.props.enterpriseId),
30+
EnterpriseCatalogApiService.fetchEnterpriseCustomerCatalogs(this.props.enterpriseId),
3031
LMSApiService.fetchReportingConfigTypes(this.props.enterpriseId),
3132
])
3233
.then((responses) => {

src/data/services/EnterpriseCatalogApiService.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ class EnterpriseCatalogApiService {
77

88
static apiClient = getAuthenticatedHttpClient;
99

10+
static enterpriseCustomerCatalogsUrl = `${EnterpriseCatalogApiService.baseUrl}/enterprise-catalogs/`;
11+
1012
static fetchApplicableCatalogs({ enterpriseId, courseRunIds }) {
1113
// This API call will *only* obtain the enterprise's catalogs whose
1214
// catalog queries return/contain the specified courseRunIds.
@@ -23,6 +25,10 @@ class EnterpriseCatalogApiService {
2325
},
2426
).get(url);
2527
}
28+
29+
static fetchEnterpriseCustomerCatalogs(enterpriseId) {
30+
return EnterpriseCatalogApiService.apiClient().get(`${EnterpriseCatalogApiService.enterpriseCustomerCatalogsUrl}?enterprise_customer=${enterpriseId}`);
31+
}
2632
}
2733

2834
export default EnterpriseCatalogApiService;

src/data/services/LmsApiService.js

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,6 @@ class LmsApiService {
2424

2525
static createPendingUsersUrl = `${LmsApiService.baseUrl}/enterprise/api/v1/link_pending_enterprise_users`;
2626

27-
static enterpriseCustomerCatalogsUrl = `${LmsApiService.baseUrl}/enterprise/api/v1/enterprise_catalogs/`;
28-
2927
static notificationReadUrl = `${LmsApiService.baseUrl}/enterprise/api/v1/read_notification`;
3028

3129
static enterpriseCustomerInviteKeyListUrl = `${LmsApiService.baseUrl}/enterprise/api/v1/enterprise-customer-invite-key/basic-list/`;
@@ -253,10 +251,6 @@ class LmsApiService {
253251
return LmsApiService.apiClient().post(`${LmsApiService.createPendingUsersUrl}/${uuid}`, formData);
254252
}
255253

256-
static fetchEnterpriseCustomerCatalogs(enterpriseId) {
257-
return LmsApiService.apiClient().get(`${LmsApiService.enterpriseCustomerCatalogsUrl}?enterprise_customer=${enterpriseId}`);
258-
}
259-
260254
static markBannerNotificationAsRead(formData) {
261255
return LmsApiService.apiClient().post(LmsApiService.notificationReadUrl, formData);
262256
}

0 commit comments

Comments
 (0)