Skip to content

Commit

Permalink
feat: sort for courses alphabetically
Browse files Browse the repository at this point in the history
  • Loading branch information
01001110J committed Nov 19, 2024
1 parent 7d9106b commit 81b9b22
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"react": "16.14.0",
"react-dom": "16.14.0",
"react-intl": "^5.25.1",
"react-paragon-topaz": "^1.16.0",
"react-paragon-topaz": "1.19.1",
"react-redux": "^7.2.9",
"react-router": "5.2.1",
"react-router-dom": "5.3.0",
Expand Down
10 changes: 8 additions & 2 deletions src/features/Courses/data/thunks.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { logError } from '@edx/frontend-platform/logging';
import { camelCaseObject } from '@edx/frontend-platform';
import { sortAlphabetically } from 'react-paragon-topaz';

import {
fetchCoursesDataRequest,
fetchCoursesDataSuccess,
Expand All @@ -21,7 +23,9 @@ function fetchCoursesData(id, currentPage, filtersData) {

try {
const response = camelCaseObject(await getCoursesByInstitution(id, true, currentPage, filtersData));
dispatch(fetchCoursesDataSuccess(response.data));
const sortedResponse = sortAlphabetically(response.data);

dispatch(fetchCoursesDataSuccess(sortedResponse));
} catch (error) {
dispatch(fetchCoursesDataFailed());
logError(error);
Expand All @@ -35,7 +39,9 @@ function fetchCoursesOptionsData(institutionId, limit = false, page = initialPag

try {
const response = camelCaseObject(await getCoursesByInstitution(institutionId, limit, page, params));
dispatch(updateCoursesOptions(response.data));
const sortedResponse = sortAlphabetically(response.data);

dispatch(updateCoursesOptions(sortedResponse));
} catch (error) {
dispatch(fetchCoursesDataFailed());
logError(error);
Expand Down

0 comments on commit 81b9b22

Please sign in to comment.