From febed9adc4f3f1f033fbf78e378943c94ab6451b Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Fri, 19 Oct 2018 10:36:31 +0200 Subject: [PATCH] Fetch topic information from API --- client/src/graphql/gql/allModules.gql | 7 ++--- .../src/graphql/gql/fragments/moduleParts.gql | 7 +++++ client/src/graphql/gql/topicQuery.gql | 16 ++++++++++ client/src/pages/topic.vue | 30 ++++++++++++------- server/books/schema/queries.py | 12 +++++++- 5 files changed, 56 insertions(+), 16 deletions(-) create mode 100644 client/src/graphql/gql/fragments/moduleParts.gql create mode 100644 client/src/graphql/gql/topicQuery.gql diff --git a/client/src/graphql/gql/allModules.gql b/client/src/graphql/gql/allModules.gql index b572a7b2..c4b548de 100644 --- a/client/src/graphql/gql/allModules.gql +++ b/client/src/graphql/gql/allModules.gql @@ -1,12 +1,9 @@ +#import "./fragments/moduleParts.gql" query ModulesQuery { modules { edges { node { - id - title - metaTitle - teaser - slug + ...ModuleParts } } } diff --git a/client/src/graphql/gql/fragments/moduleParts.gql b/client/src/graphql/gql/fragments/moduleParts.gql new file mode 100644 index 00000000..6dbb929e --- /dev/null +++ b/client/src/graphql/gql/fragments/moduleParts.gql @@ -0,0 +1,7 @@ +fragment ModuleParts on ModuleNode { + id + title + metaTitle + teaser + slug +} diff --git a/client/src/graphql/gql/topicQuery.gql b/client/src/graphql/gql/topicQuery.gql new file mode 100644 index 00000000..38a3a931 --- /dev/null +++ b/client/src/graphql/gql/topicQuery.gql @@ -0,0 +1,16 @@ +#import "./fragments/moduleParts.gql" +query Topic($slug: String!){ + topic(slug: $slug) { + id + title + teaser + description + modules { + edges { + node { + ...ModuleParts + } + } + } + } +} diff --git a/client/src/pages/topic.vue b/client/src/pages/topic.vue index a2281643..fee429e4 100644 --- a/client/src/pages/topic.vue +++ b/client/src/pages/topic.vue @@ -1,11 +1,8 @@