diff --git a/src/news/container/News.tsx b/src/news/container/News.tsx
index 144d2e3b..e831ed14 100644
--- a/src/news/container/News.tsx
+++ b/src/news/container/News.tsx
@@ -45,7 +45,7 @@ const News: React.FC = () => {
dispatch(NewsActions.load());
}, [newsList]);
- const carouselItems = newsList?.map(entry => (
+ const carouselItems = newsList?.filter(entry => entry.frontpage).map(entry => (
{entry.image && }
@@ -53,14 +53,14 @@ const News: React.FC = () => {
{entry.content}
- ));
+ )) ?? [];
return (
{news.pending === PendingState.LOADING && (
)}
- {carouselItems != null && (
+ {carouselItems.length > 0 && (
1} indicators={carouselItems.length > 1}>
{carouselItems}
diff --git a/src/news/store/types.ts b/src/news/store/types.ts
index f96d39a3..04316541 100644
--- a/src/news/store/types.ts
+++ b/src/news/store/types.ts
@@ -3,24 +3,27 @@ import ArrayReducerType from '../../common/store/ArrayReducerType';
import { ACTION, GenericArrayReducerAction } from '../../common/store/ReduxHelper';
export type NewsItemDto = {
- id: number;
- image: string;
- title: string;
- content: string;
+ id: number;
+ image: string;
+ title: string;
+ content: string;
+ frontpage: boolean;
}
export type NewsItem = {
- id: number;
- image: string;
- title: string;
- content: string;
+ id: number;
+ image: string;
+ title: string;
+ content: string;
+ frontpage: boolean;
}
export const toNewsItem = (dto: NewsItemDto): NewsItem => ({
- id: dto.id,
- image: dto.image,
- title: dto.title,
- content: dto.content,
+ id: dto.id,
+ image: dto.image,
+ title: dto.title,
+ content: dto.content,
+ frontpage: dto.frontpage,
});
export const NEWS_STORE = '@@news';