Skip to content
This repository was archived by the owner on Jun 28, 2025. It is now read-only.

Commit 36719da

Browse files
author
Manuel Proß
committed
fix(web): add headline for news section to render it properly
1 parent 7c3e790 commit 36719da

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

web/src/app/api/[homepage]/route.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,19 @@ export async function GET() {
1515

1616
const homePageData = (await res.json()) as SingleType;
1717

18+
if (!homePageData.data.attributes) {
19+
return Response.json("Homepage contains no Data");
20+
}
1821
const news = homePageData.data.attributes.body
1922
.map((el, i) => {
20-
if ("newsCount" in el) return { index: i, newsCount: el.newsCount };
23+
if ("newsCount" in el) return { index: i, headline: el.headline, newsCount: el.newsCount };
2124
})
2225
.filter(Boolean);
2326

2427
for (const newsEntry of news) {
2528
if (!newsEntry) break;
2629
const fetchedNews = await getNews(newsEntry?.newsCount);
30+
fetchedNews.headline = newsEntry.headline;
2731

2832
homePageData.data.attributes.body[newsEntry.index] = fetchedNews;
2933
}

0 commit comments

Comments
 (0)