diff --git a/front/src/store/index.js b/front/src/store/index.js index e111966a0714e20578ad76d592325ec2cb3c364d..2453c0e7134124e3f9d9dc3ffac47d2558a9827d 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 a4dfcada65028f27a7fd4c61741b1f14d43d6dcd..2436eab079cd72f11fe48ecf2f64e857bc4f1e58 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: {