diff --git a/front/src/store/index.js b/front/src/store/index.js index e111966a0..2453c0e71 100644 --- a/front/src/store/index.js +++ b/front/src/store/index.js @@ -30,6 +30,10 @@ export default new Vuex.Store({ return mutation.type.startsWith('auth/') } }), + createPersistedState({ + key: 'instance', + paths: ['instance.events'] + }), createPersistedState({ key: 'radios', paths: ['radios'], diff --git a/front/src/store/instance.js b/front/src/store/instance.js index a4dfcada6..2436eab07 100644 --- a/front/src/store/instance.js +++ b/front/src/store/instance.js @@ -5,6 +5,8 @@ import _ from 'lodash' export default { namespaced: true, state: { + maxEvents: 200, + events: [], settings: { instance: { name: { @@ -35,6 +37,12 @@ export default { mutations: { settings: (state, 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: {