Skip to content

Commit

Permalink
fix: add help topics to services listing page (#431)
Browse files Browse the repository at this point in the history
  • Loading branch information
aprigge authored Jun 28, 2022
1 parent e8274a5 commit cf6ef33
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 1 deletion.
10 changes: 10 additions & 0 deletions gql/queries/HelpTopicList.gql
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
query HelpTopicList {
entries(section: "helpTopic") {
... on helpTopic_helpTopic_Entry {
id
to: slug
title
summary
}
}
}
27 changes: 26 additions & 1 deletion pages/help/services-resources/index.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<template lang="html">
<div class="page page-help">
<h3>Services and Resources</h3>
<nuxt-link
v-for="item in parsedServiceAndResourceList"
:key="item.to"
Expand All @@ -10,21 +11,37 @@
v-html="item.title"
/>
</nuxt-link>
<br>
<h3>Help Topics</h3>
<nuxt-link
v-for="item in parsedHelpTopicList"
:key="item.to"
:to="item.to"
>
<div
class="text"
v-html="item.title"
/>
</nuxt-link>
</div>
</template>

<script>
// gql
import SERVICE_AND_RESOURCE_LIST from "~/gql/queries/ServiceAndResourceList"
import HELP_TOPIC_LIST from "~/gql/queries/HelpTopicList"
export default {
async asyncData({ $graphql, params }) {
const data = await $graphql.default.request(SERVICE_AND_RESOURCE_LIST, {
uri: params.path,
})
const helpTopicData = await $graphql.default.request(HELP_TOPIC_LIST, {
uri: params.path,
})
return {
page: data,
helpTopic: helpTopicData,
}
},
computed: {
Expand All @@ -36,6 +53,14 @@ export default {
}
})
},
parsedHelpTopicList() {
return this.helpTopic.entries.map((obj) => {
return {
...obj,
to: `/help/${obj.to}`,
}
})
},
},
}
</script>
Expand Down

3 comments on commit cf6ef33

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@github-actions
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.