2021-08-18 13:50:24 +02:00
|
|
|
|
|
|
|
export const state = () => ({
|
2021-08-19 03:18:44 +02:00
|
|
|
settings: {
|
|
|
|
orderBy: 'book.title',
|
|
|
|
orderDesc: false,
|
|
|
|
filterBy: 'all'
|
|
|
|
},
|
|
|
|
|
|
|
|
listeners: []
|
2021-08-18 13:50:24 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
export const getters = {
|
2021-08-19 03:18:44 +02:00
|
|
|
getFilterOrderKey: (state) => {
|
|
|
|
return Object.values(state.settings).join('-')
|
|
|
|
}
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
export const actions = {
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
export const mutations = {
|
|
|
|
setSettings(state, settings) {
|
2021-08-19 03:18:44 +02:00
|
|
|
state.settings = {
|
|
|
|
...settings
|
|
|
|
}
|
|
|
|
state.listeners.forEach((listener) => {
|
|
|
|
listener.meth()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
addListener(state, listener) {
|
|
|
|
var index = state.listeners.findIndex(l => l.id === listener.id)
|
|
|
|
if (index >= 0) state.listeners.splice(index, 1, listener)
|
|
|
|
else state.listeners.push(listener)
|
|
|
|
},
|
|
|
|
removeListener(state, listenerId) {
|
|
|
|
state.listeners = state.listeners.filter(l => l.id !== listenerId)
|
2021-08-18 13:50:24 +02:00
|
|
|
}
|
|
|
|
}
|