Verified Commit e319f593 authored by Eliot Berriot's avatar Eliot Berriot
Browse files

Store for instance events

parent 40350f05
...@@ -30,6 +30,10 @@ export default new Vuex.Store({ ...@@ -30,6 +30,10 @@ export default new Vuex.Store({
return mutation.type.startsWith('auth/') return mutation.type.startsWith('auth/')
} }
}), }),
createPersistedState({
key: 'instance',
paths: ['instance.events']
}),
createPersistedState({ createPersistedState({
key: 'radios', key: 'radios',
paths: ['radios'], paths: ['radios'],
......
...@@ -5,6 +5,8 @@ import _ from 'lodash' ...@@ -5,6 +5,8 @@ import _ from 'lodash'
export default { export default {
namespaced: true, namespaced: true,
state: { state: {
maxEvents: 200,
events: [],
settings: { settings: {
instance: { instance: {
name: { name: {
...@@ -35,6 +37,12 @@ export default { ...@@ -35,6 +37,12 @@ export default {
mutations: { mutations: {
settings: (state, value) => { settings: (state, value) => {
_.merge(state.settings, value) _.merge(state.settings, value)
},
event: (state, value) => {
state.events.unshift(value)
if (state.events.length > state.maxEvents) {
state.events = state.events.slice(0, state.maxEvents)
}
} }
}, },
actions: { actions: {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment