From 867f608a35da1ecf1741831348c7298ddc36849f Mon Sep 17 00:00:00 2001 From: jajjibhai008 Date: Tue, 18 Feb 2025 17:36:59 +0500 Subject: [PATCH] feat: update the groups dropdown filters data source to enterprise groups --- src/components/Admin/AdminSearchForm.jsx | 6 +++--- .../data/hooks/useAllFlexEnterpriseGroups.js | 2 +- src/data/actions/enterpriseGroups.js | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/components/Admin/AdminSearchForm.jsx b/src/components/Admin/AdminSearchForm.jsx index a07623befb..ac4049d765 100644 --- a/src/components/Admin/AdminSearchForm.jsx +++ b/src/components/Admin/AdminSearchForm.jsx @@ -122,10 +122,10 @@ class AdminSearchForm extends React.Component { {groups.map(group => ( ))} diff --git a/src/components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups.js b/src/components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups.js index eb6e2f1f2b..a8af3d50a1 100644 --- a/src/components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups.js +++ b/src/components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups.js @@ -10,7 +10,7 @@ import { fetchPaginatedData } from '../../../../data/services/apiServiceUtils'; * @param {*} queryKey The queryKey from the associated `useQuery` call. * @returns The enterprise group object */ -const getAllFlexEnterpriseGroups = async ({ enterpriseId }) => { +export const getAllFlexEnterpriseGroups = async ({ enterpriseId }) => { const { results } = await fetchPaginatedData(`${LmsApiService.enterpriseGroupListUrl}?enterprise_uuids=${enterpriseId}`); const flexGroups = results.filter(result => result.groupType === 'flex'); return flexGroups; diff --git a/src/data/actions/enterpriseGroups.js b/src/data/actions/enterpriseGroups.js index a581520453..eddf2f9511 100644 --- a/src/data/actions/enterpriseGroups.js +++ b/src/data/actions/enterpriseGroups.js @@ -5,7 +5,7 @@ import { FETCH_ENTERPRISE_GROUPS_FAILURE, CLEAR_ENTERPRISE_GROUPS, } from '../constants/enterpriseGroups'; -import EnterpriseDataApiService from '../services/EnterpriseDataApiService'; +import { getAllFlexEnterpriseGroups } from '../../components/learner-credit-management/data/hooks/useAllFlexEnterpriseGroups'; const fetchEnterpriseGroupsRequest = () => ({ type: FETCH_ENTERPRISE_GROUPS_REQUEST }); const fetchEnterpriseGroupsSuccess = data => ({ @@ -20,9 +20,9 @@ const fetchEnterpriseGroupsFailure = error => ({ const fetchEnterpriseGroups = enterpriseId => ( (dispatch) => { dispatch(fetchEnterpriseGroupsRequest()); - return EnterpriseDataApiService.fetchEnterpriseGroups(enterpriseId) + return getAllFlexEnterpriseGroups({ enterpriseId }) .then((response) => { - dispatch(fetchEnterpriseGroupsSuccess(response.data)); + dispatch(fetchEnterpriseGroupsSuccess(response)); }) .catch((error) => { logError(error);