From 43f1fc3ce52e6ddd397853964c8868f2f4eee41d Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Sun, 13 Feb 2022 18:15:07 +0100 Subject: chore: improve RSS feed generation time --- src/services/graphql/queries.ts | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'src/services/graphql/queries.ts') diff --git a/src/services/graphql/queries.ts b/src/services/graphql/queries.ts index 0817cf6..a9b3141 100644 --- a/src/services/graphql/queries.ts +++ b/src/services/graphql/queries.ts @@ -1,5 +1,5 @@ import { Slug } from '@ts/types/app'; -import { Article, PostBy } from '@ts/types/articles'; +import { Article, PostBy, TotalArticles } from '@ts/types/articles'; import { AllPostsSlug, PostsList, RawPostsList } from '@ts/types/blog'; import { AllTopics, @@ -26,6 +26,21 @@ import { fetchApi } from './api'; // Posts list queries //============================================================================== +export const getPostsTotal = async (): Promise => { + const query = gql` + query PostsTotal { + posts { + pageInfo { + total + } + } + } + `; + + const response = await fetchApi(query, null); + return response.posts.pageInfo.total; +}; + export const getPublishedPosts = async ({ first = 10, after = '', -- cgit v1.2.3