From b405ddb76f217ccf7828b422ec4c0f0e15b7dee4 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Fri, 7 Jan 2022 12:33:35 +0100 Subject: chore: add a widget to list all blog topics --- src/services/graphql/queries.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'src/services') diff --git a/src/services/graphql/queries.ts b/src/services/graphql/queries.ts index 26a7869..f5387e5 100644 --- a/src/services/graphql/queries.ts +++ b/src/services/graphql/queries.ts @@ -2,11 +2,13 @@ import { Slug } from '@ts/types/app'; import { Article, PostBy } from '@ts/types/articles'; import { AllPostsSlug, PostsList, RawPostsList } from '@ts/types/blog'; import { + AllSubjects, AllSubjectsSlug, AllThematics, AllThematicsSlug, Subject, SubjectBy, + SubjectPreview, Thematic, ThematicBy, ThematicPreview, @@ -344,6 +346,23 @@ export const getAllSubjectsSlug = async (): Promise => { return response.subjects.nodes; }; +export const getAllSubjects = async (): Promise => { + const query = gql` + query AllSubjects { + subjects { + nodes { + databaseId + slug + title + } + } + } + `; + + const response = await fetchApi(query, null); + return response.subjects.nodes; +}; + //============================================================================== // Thematic query //============================================================================== -- cgit v1.2.3