aboutsummaryrefslogtreecommitdiff
path: root/src/site/store/alert.js
blob: 78c0eaf5446d2f5a1888cca8662531db3c0c56e7 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/* eslint-disable no-shadow */
const getDefaultState = () => ({
	text: null,
	error: false
});

export const state = getDefaultState;

export const actions = {
	set({ commit }, data) {
		commit('set', data);
	},
	clear({ commit }) {
		commit('clear');
	}
};

export const mutations = {
	set(state, { text, error }) {
		state.text = text;
		state.error = error;
	},
	clear(state) {
		Object.assign(state, getDefaultState());
	}
};