Skip to content

Commit

Permalink
fix: Fix course selection not crashing if missing language fields fro…
Browse files Browse the repository at this point in the history
…m sisu data
  • Loading branch information
HRemonen committed Sep 20, 2023
1 parent 80f3595 commit f07f380
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/client/util/courses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,12 @@ export const otherCourse = {
}

export const getCourseName = (course: Course, language: keyof Locales) => {
console.log(course)
const name =
course.name[language as keyof Locales].length >
course.nameSpecifier[language as keyof Locales].length
? course.name
: course.nameSpecifier
course.name[language as keyof Locales]?.length >
course.nameSpecifier[language as keyof Locales]?.length
? course?.name
: course?.nameSpecifier

return name
}
Expand Down

0 comments on commit f07f380

Please sign in to comment.