add kit store
This commit is contained in:
+3
-1
@@ -3,12 +3,14 @@ import Vuex from 'vuex'
|
|||||||
|
|
||||||
import nodes from './nodes'
|
import nodes from './nodes'
|
||||||
import library from './modules/library'
|
import library from './modules/library'
|
||||||
|
import kit from './modules/kit'
|
||||||
|
|
||||||
Vue.use(Vuex)
|
Vue.use(Vuex)
|
||||||
|
|
||||||
export default new Vuex.Store({
|
export default new Vuex.Store({
|
||||||
...nodes,
|
...nodes,
|
||||||
modules: {
|
modules: {
|
||||||
library
|
library,
|
||||||
|
kit
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -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
@@ -25,7 +25,7 @@ export const ID_VARIANTS = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export const VARIANT_IDS = Object.fromEntries(
|
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']
|
export const SEARCH_KEYS = ['content', 'title', 'preTitle', 'authors']
|
||||||
|
|||||||
Reference in New Issue
Block a user