Skip to content

Commit 74610ad

Browse files
author
Henrik Ruscon
committed
allow no tags
1 parent 5e10091 commit 74610ad

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

src/store/modules/hapi-docs.js

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@ export const state = {
55
host: '',
66
scheme: '',
77
info: null,
8-
paths: [],
8+
paths: null,
99
groups: null,
10-
tags: []
10+
tags: null
1111
}
1212

1313
export const getters = {
@@ -20,16 +20,18 @@ export const getters = {
2020
groupedPaths: getters => {
2121
const grouped = []
2222

23-
getters.tags.forEach(tag => {
24-
const group = getters.groups.find(group => group === tag.name)
23+
if (getters.groups) {
24+
getters.groups.forEach(group => {
25+
const tag = getters.tags.find(tag => tag.name === group)
2526

26-
grouped.push({
27-
name: tag.name,
28-
description: tag.description || null,
29-
deprecated: tag.deprecated || false,
30-
paths: getters.paths.filter(path => path.group === group)
27+
grouped.push({
28+
name: group,
29+
description: tag ? tag.description : null,
30+
deprecated: tag ? tag.deprecated : false,
31+
paths: getters.paths.filter(path => path.group === group)
32+
})
3133
})
32-
})
34+
}
3335

3436
return grouped
3537
}

0 commit comments

Comments
 (0)