Skip to content

Commit

Permalink
Pass language to getCourseList
Browse files Browse the repository at this point in the history
  • Loading branch information
robertying committed Sep 10, 2023
1 parent f78c576 commit 6c3f712
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/data/actions/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import {
SET_HIDE_COURSE,
} from 'data/types/constants';
import {Course} from 'data/types/state';
import {getLocale} from 'helpers/i18n';

export const getCoursesForSemesterAction = createAsyncAction(
GET_COURSES_FOR_SEMESTER_REQUEST,
Expand All @@ -20,8 +21,14 @@ export function getCoursesForSemester(semesterId: string): ThunkResult {
return async dispatch => {
dispatch(getCoursesForSemesterAction.request());

const lang = getLocale().startsWith('zh') ? 'zh' : 'en';

try {
const results = await dataSource.getCourseList(semesterId);
const results = await dataSource.getCourseList(
semesterId,
undefined,
lang,
);
const courses = results
.map(course => ({...course, semesterId}))
.sort((a, b) => a.id.localeCompare(b.id));
Expand Down

0 comments on commit 6c3f712

Please sign in to comment.