schlechtenburg/src/store.ts

36 lines
615 B
TypeScript
Raw Normal View History

2020-05-20 14:21:08 +00:00
import { GetterTree, MutationTree, ActionTree } from 'vuex';
interface State {
activeBlockId: number|null;
};
const state: State = {
activeBlockId: null,
};
const getters = {
activeBlockId: (s) => s.activeBlockId,
} as GetterTree<State, any>;
const actions = {
setActiveBlock({ commit }, id) {
commit('setActiveBlock', id);
},
} as ActionTree<State, any>;
const mutations = {
setActiveBlock(s, id) {
s.activeBlockId = id;
},
} as MutationTree<State>;
const SchlechtenburgModule = {
namespaced: true,
state,
getters,
mutations,
actions,
};
export default SchlechtenburgModule;