diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-02-13 18:15:07 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-02-13 19:12:22 +0100 |
| commit | 43f1fc3ce52e6ddd397853964c8868f2f4eee41d (patch) | |
| tree | 1c631893cd79c4f2be048e4f7c36a4e2671e5f44 /src/services | |
| parent | 65bf38646c303399daf0766a10dc7893b78d8301 (diff) | |
chore: improve RSS feed generation time
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/graphql/queries.ts | 17 |
1 files changed, 16 insertions, 1 deletions
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<number> => { + const query = gql` + query PostsTotal { + posts { + pageInfo { + total + } + } + } + `; + + const response = await fetchApi<TotalArticles>(query, null); + return response.posts.pageInfo.total; +}; + export const getPublishedPosts = async ({ first = 10, after = '', |
