refactor: Cleanup
This commit is contained in:
parent
4bf82b09fa
commit
413220c54f
9 changed files with 53 additions and 34 deletions
|
@ -3,18 +3,16 @@ import { themes } from '../data/themes.js';
|
|||
import { loadTranslations } from '../util/translation-helper.js';
|
||||
|
||||
interface Translations {
|
||||
curricula_page: {
|
||||
[key: string]: { title: string; description?: string };
|
||||
};
|
||||
curricula_page: Record<string, { title: string; description?: string }>;
|
||||
}
|
||||
|
||||
export function getThemes(req: Request, res: Response): void {
|
||||
const language = (req.query.language as string)?.toLowerCase() || 'nl';
|
||||
const language = (req.query.language as string).toLowerCase() || 'nl';
|
||||
const translations = loadTranslations<Translations>(language);
|
||||
const themeList = themes.map((theme) => ({
|
||||
key: theme.title,
|
||||
title: translations.curricula_page[theme.title]?.title || theme.title,
|
||||
description: translations.curricula_page[theme.title]?.description,
|
||||
title: translations.curricula_page[theme.title].title || theme.title,
|
||||
description: translations.curricula_page[theme.title].description,
|
||||
image: `https://dwengo.org/images/curricula/logo_${theme.title}.png`,
|
||||
}));
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue