This repository has been archived on 2024-02-08. You can view files and clone it, but cannot push or open issues or pull requests.
2020-05-11 14:52:58 +00:00
|
|
|
import Vue from 'vue'
|
|
|
|
|
|
|
|
export default {
|
|
|
|
namespaced: true,
|
|
|
|
// The state is an object which has the list ids as keys.
|
|
|
|
state: () => ({}),
|
|
|
|
mutations: {
|
|
|
|
addList(state, list) {
|
|
|
|
Vue.set(state, list.id, list)
|
|
|
|
},
|
|
|
|
addLists(state, lists) {
|
|
|
|
lists.forEach(l => {
|
|
|
|
Vue.set(state, l.id, l)
|
|
|
|
})
|
|
|
|
},
|
|
|
|
},
|
|
|
|
getters: {
|
|
|
|
getListById: state => id => {
|
2020-09-05 20:35:52 +00:00
|
|
|
if (typeof state[id] !== 'undefined') {
|
2020-05-11 14:52:58 +00:00
|
|
|
return state[id]
|
|
|
|
}
|
|
|
|
return null
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|