fix orderedTextDepart getter
This commit is contained in:
@@ -15,7 +15,7 @@ export default {
|
||||
state: {
|
||||
trees: {},
|
||||
randomNodes: undefined,
|
||||
nodebook: undefined,
|
||||
nodebook: [],
|
||||
|
||||
// LibraryOptions options
|
||||
tagsOptions: [],
|
||||
@@ -219,20 +219,20 @@ export default {
|
||||
|
||||
nodesDepartsOptions: (state, getters, rootState) => {
|
||||
const departIds = rootState.ids.depart
|
||||
if (departIds === undefined || rootState.nodes[departIds[0]] === undefined) return
|
||||
return departIds.map(id => {
|
||||
const text = rootState.nodes[id]
|
||||
const firstAuthor = text.authors !== null ? text.authors[0].name : 'Pad de noms'
|
||||
if (departIds === undefined) return
|
||||
const nodes = departIds.map(id => rootState.nodes[id])
|
||||
if (nodes.some(node => node === undefined)) return
|
||||
return nodes.map(node => {
|
||||
const firstAuthor = node.authors !== null ? node.authors[0].name : 'Pad de noms'
|
||||
return {
|
||||
text: `${firstAuthor}, ${text.title} (${id})`,
|
||||
value: id
|
||||
text: `${firstAuthor}, ${node.title} (${node.id})`,
|
||||
value: node.id
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
// Library
|
||||
nodebook: (state, getters, rootState) => {
|
||||
if (!state.nodebook) return []
|
||||
return state.nodebook.map(([parentId, ...childrenIds]) => {
|
||||
return {
|
||||
parent: rootState.nodes[parentId],
|
||||
|
||||
Reference in New Issue
Block a user