diff options
Diffstat (limited to 'src/services/graphql/fetchers/posts')
| -rw-r--r-- | src/services/graphql/fetchers/posts/fetch-all-posts-slugs.ts | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/services/graphql/fetchers/posts/fetch-all-posts-slugs.ts b/src/services/graphql/fetchers/posts/fetch-all-posts-slugs.ts index 28f2bbf..25cc782 100644 --- a/src/services/graphql/fetchers/posts/fetch-all-posts-slugs.ts +++ b/src/services/graphql/fetchers/posts/fetch-all-posts-slugs.ts @@ -1,6 +1,5 @@ import type { GraphQLNodes, Nullable, SlugNode } from '../../../../types'; import { fetchGraphQL, getGraphQLUrl } from '../../../../utils/helpers'; -import { fetchPostsCount } from './fetch-posts-count'; type PostsSlugsResponse = { posts: Nullable<GraphQLNodes<SlugNode>>; @@ -17,14 +16,14 @@ const postsSlugsQuery = `query PostsSlugs($first: Int) { /** * Retrieve the WordPress posts slugs. * + * @param {number} count - The number of posts slugs to retrieve. * @returns {Promise<string[]>} The posts slugs. */ -export const fetchAllPostsSlugs = async (): Promise<string[]> => { - const postsCount = await fetchPostsCount(); +export const fetchAllPostsSlugs = async (count: number): Promise<string[]> => { const response = await fetchGraphQL<PostsSlugsResponse>({ query: postsSlugsQuery, url: getGraphQLUrl(), - variables: { first: postsCount }, + variables: { first: count }, }); if (!response.posts) |
