From 261611ab68ed967893894b98d23832bc88e15fa8 Mon Sep 17 00:00:00 2001 From: Brayan Ceron Date: Fri, 27 Dec 2024 13:35:22 -0500 Subject: [PATCH] refactor: sort institution select alphabetically --- src/features/Main/data/thunks.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/features/Main/data/thunks.js b/src/features/Main/data/thunks.js index b35b0343..92aec21f 100644 --- a/src/features/Main/data/thunks.js +++ b/src/features/Main/data/thunks.js @@ -1,5 +1,6 @@ import { logError } from '@edx/frontend-platform/logging'; import { camelCaseObject } from '@edx/frontend-platform'; +import { sortAlphabetically } from 'react-paragon-topaz'; import { getInstitutionName } from 'features/Main/data/api'; import { fetchInstitutionDataRequest, @@ -11,8 +12,9 @@ function fetchInstitutionData() { return async (dispatch) => { dispatch(fetchInstitutionDataRequest()); try { - const response = camelCaseObject(await getInstitutionName()); - dispatch(fetchInstitutionDataSuccess(response.data)); + const { data } = camelCaseObject(await getInstitutionName()); + const sortedData = sortAlphabetically(data, 'name'); + dispatch(fetchInstitutionDataSuccess(sortedData)); } catch (error) { dispatch(fetchInstitutionDataFailed()); logError(error);