add kit store

This commit is contained in:
axolotle
2021-07-01 14:29:02 +02:00
parent 305992d340
commit 1387bbed69
3 changed files with 26 additions and 2 deletions
+3 -1
View File
@@ -3,12 +3,14 @@ import Vuex from 'vuex'
import nodes from './nodes'
import library from './modules/library'
import kit from './modules/kit'
Vue.use(Vuex)
export default new Vuex.Store({
...nodes,
modules: {
library
library,
kit
}
})
+22
View File
@@ -0,0 +1,22 @@
export default {
state: {
},
mutations: {
},
actions: {
async 'INIT_KIT' ({ state, commit, dispatch, getters }, payload) {
const ids = await dispatch('GET_ALL_NODES_IDS', 'kit')
return dispatch('GET_NODES', { ids, dataLevel: 'partial' })
}
},
getters: {
sheets: (state, getters, rootState) => {
const kitIds = rootState.ids.kit
if (kitIds === undefined || rootState.nodes[kitIds[0]] === undefined) return
return kitIds.map(id => rootState.nodes[id])
}
}
}
+1 -1
View File
@@ -25,7 +25,7 @@ export const ID_VARIANTS = {
}
export const VARIANT_IDS = Object.fromEntries(
Object.entries(ID_VARIANTS).map(([key, value]) => [value, key])
Object.entries(ID_VARIANTS).map(([key, value]) => [value, parseInt(key)])
)
export const SEARCH_KEYS = ['content', 'title', 'preTitle', 'authors']