summaryrefslogtreecommitdiffstats
path: root/src/services
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2022-01-07 12:01:08 +0100
committerArmand Philippot <git@armandphilippot.com>2022-01-07 12:31:56 +0100
commitb4e12398fbeb642c12649dcccdf4d5cdefa471e3 (patch)
tree0744b64eed4214813e70ed26ad4a18058a4a46af /src/services
parent722ec20bad64d8c69b173c163011d37ad0b55591 (diff)
chore: add a widget to list all blog thematics
Diffstat (limited to 'src/services')
-rw-r--r--src/services/graphql/queries.ts19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/services/graphql/queries.ts b/src/services/graphql/queries.ts
index afc9f69..26a7869 100644
--- a/src/services/graphql/queries.ts
+++ b/src/services/graphql/queries.ts
@@ -3,11 +3,13 @@ import { Article, PostBy } from '@ts/types/articles';
import { AllPostsSlug, PostsList, RawPostsList } from '@ts/types/blog';
import {
AllSubjectsSlug,
+ AllThematics,
AllThematicsSlug,
Subject,
SubjectBy,
Thematic,
ThematicBy,
+ ThematicPreview,
} from '@ts/types/taxonomies';
import {
getFormattedPost,
@@ -449,3 +451,20 @@ export const getAllThematicsSlug = async (): Promise<Slug[]> => {
const response = await fetchApi<AllThematicsSlug>(query, null);
return response.thematics.nodes;
};
+
+export const getAllThematics = async (): Promise<ThematicPreview[]> => {
+ const query = gql`
+ query AllThematics {
+ thematics {
+ nodes {
+ databaseId
+ slug
+ title
+ }
+ }
+ }
+ `;
+
+ const response = await fetchApi<AllThematics>(query, null);
+ return response.thematics.nodes;
+};