diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-05-13 15:39:55 +0200 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-05-13 15:46:05 +0200 |
| commit | dab72bb270ee2ee47a0b472d5e9e240cba7cbf0f (patch) | |
| tree | a64a49a1048eeab1204a9b04923135edd1f259e1 /src/utils/helpers/rss.ts | |
| parent | c5b516e2c933e77b2550fe6becebacb3fbdd30eb (diff) | |
chore: handle blog pagination
Diffstat (limited to 'src/utils/helpers/rss.ts')
| -rw-r--r-- | src/utils/helpers/rss.ts | 13 |
1 files changed, 11 insertions, 2 deletions
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<Article[]> => { 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; }; |
