diff options
| author | Armand Philippot <git@armandphilippot.com> | 2022-01-07 12:33:35 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2022-01-07 12:34:34 +0100 |
| commit | b405ddb76f217ccf7828b422ec4c0f0e15b7dee4 (patch) | |
| tree | b6313b139f018f09d9bb88dedb7c5b3e4d84ef76 /src/services | |
| parent | b4e12398fbeb642c12649dcccdf4d5cdefa471e3 (diff) | |
chore: add a widget to list all blog topics
Diffstat (limited to 'src/services')
| -rw-r--r-- | src/services/graphql/queries.ts | 19 |
1 files changed, 19 insertions, 0 deletions
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<Slug[]> => { return response.subjects.nodes; }; +export const getAllSubjects = async (): Promise<SubjectPreview[]> => { + const query = gql` + query AllSubjects { + subjects { + nodes { + databaseId + slug + title + } + } + } + `; + + const response = await fetchApi<AllSubjects>(query, null); + return response.subjects.nodes; +}; + //============================================================================== // Thematic query //============================================================================== |
