Merge branch 'dev' into feat/home-data
This commit is contained in:
commit
1531fa36fe
20 changed files with 931 additions and 35 deletions
|
@ -1,6 +1,7 @@
|
|||
import { Request, Response } from 'express';
|
||||
import { themes } from '../data/themes.js';
|
||||
import { loadTranslations } from "../util/translationHelper.js";
|
||||
import { FALLBACK_LANG } from '../config.js';
|
||||
|
||||
interface Translations {
|
||||
curricula_page: {
|
||||
|
@ -8,13 +9,9 @@ interface Translations {
|
|||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /themes → Haalt de lijst met thema's op inclusief vertalingen
|
||||
*/
|
||||
export function getThemes(req: Request, res: Response) {
|
||||
const language = (req.query.language as string)?.toLowerCase() || 'nl';
|
||||
const translations = loadTranslations<Translations>(language);
|
||||
|
||||
const themeList = themes.map((theme) => {
|
||||
return {
|
||||
key: theme.title,
|
||||
|
@ -28,9 +25,6 @@ export function getThemes(req: Request, res: Response) {
|
|||
res.json(themeList);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET /themes/:theme → Geeft de HRUIDs terug voor een specifiek thema
|
||||
*/
|
||||
export function getThemeByTitle(req: Request, res: Response) {
|
||||
const themeKey = req.params.theme;
|
||||
const theme = themes.find((t) => {
|
||||
|
@ -40,6 +34,6 @@ export function getThemeByTitle(req: Request, res: Response) {
|
|||
if (theme) {
|
||||
res.json(theme.hruids);
|
||||
} else {
|
||||
res.status(404).json({ error: 'Thema niet gevonden' });
|
||||
res.status(404).json({ error: 'Theme not found' });
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue