Skip to content

Commit

Permalink
refactor: sort institution select alphabetically (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
bra-i-am authored Dec 27, 2024
1 parent 363d82b commit 34b10cd
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/features/Main/data/thunks.js
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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);
Expand Down

0 comments on commit 34b10cd

Please sign in to comment.