summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/utils/helpers/rss.ts12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/utils/helpers/rss.ts b/src/utils/helpers/rss.ts
index 3e7258a..7851ff8 100644
--- a/src/utils/helpers/rss.ts
+++ b/src/utils/helpers/rss.ts
@@ -1,12 +1,20 @@
import { config } from '@config/website';
import { getPublishedPosts } from '@services/graphql/queries';
import { ArticlePreview } from '@ts/types/articles';
+import { PostsList } from '@ts/types/blog';
import { Feed } from 'feed';
const getAllPosts = async (): Promise<ArticlePreview[]> => {
const posts: ArticlePreview[] = [];
- const postsList = await getPublishedPosts({ first: 100 });
- posts.push(...postsList.posts);
+ let hasNextPage = true;
+ let after = undefined;
+
+ do {
+ const postsList: PostsList = await getPublishedPosts({ first: 10, after });
+ posts.push(...postsList.posts);
+ hasNextPage = postsList.pageInfo.hasNextPage;
+ after = postsList.pageInfo.endCursor;
+ } while (hasNextPage);
return posts;
};