From dab72bb270ee2ee47a0b472d5e9e240cba7cbf0f Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 13 May 2022 15:39:55 +0200 Subject: chore: handle blog pagination --- src/utils/helpers/rss.ts | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/utils/helpers') diff --git a/src/utils/helpers/rss.ts b/src/utils/helpers/rss.ts index 95d3b7b..8ee774c 100644 --- a/src/utils/helpers/rss.ts +++ b/src/utils/helpers/rss.ts @@ -1,4 +1,8 @@ -import { getArticles, getTotalArticles } from '@services/graphql/articles'; +import { + getArticleFromRawData, + getArticles, + getTotalArticles, +} from '@services/graphql/articles'; import { Article } from '@ts/types/app'; import { settings } from '@utils/config'; import { Feed } from 'feed'; @@ -10,7 +14,12 @@ import { Feed } from 'feed'; */ const getAllArticles = async (): Promise => { const totalArticles = await getTotalArticles(); - const { articles } = await getArticles({ first: totalArticles }); + const rawArticles = await getArticles({ first: totalArticles }); + const articles: Article[] = []; + + rawArticles.edges.forEach((edge) => + articles.push(getArticleFromRawData(edge.node)) + ); return articles; }; -- cgit v1.2.3