feat(news): implement news section with loading state and error handling in NoLoginView
All checks were successful
Deploy to production / deploy (push) Successful in 3m8s

This commit is contained in:
Torsten Schulz (local)
2026-09-03 14:18:14 +02:00
parent c4977ec826
commit d9a46dcb34
9 changed files with 168 additions and 9 deletions

View File

@@ -7,11 +7,12 @@ import newsService from '../services/newsService.js';
export default {
async getNews(req, res) {
const counter = Math.max(0, parseInt(req.query.counter, 10) || 0);
const count = Math.min(6, Math.max(1, parseInt(req.query.count, 10) || 1));
const language = (req.query.language || 'de').slice(0, 10);
const category = (req.query.category || 'top').slice(0, 50);
try {
const { results, nextPage } = await newsService.getNews({ counter, language, category });
const { results, nextPage } = await newsService.getNews({ counter, count, language, category });
res.json({ results, nextPage });
} catch (error) {
console.error('News getNews:', error);