summaryrefslogtreecommitdiffstats
path: root/settings/src/store/index.js
blob: 2bd8d76e41bb892c30d2f4137c8debcc8a61ad45 (plain)
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
27
28
29
30
31
32
import Vue from 'vue';
import Vuex from 'vuex';
import users from './users';
import settings from './settings';
import oc from './oc';

Vue.use(Vuex)

const debug = process.env.NODE_ENV !== 'production';

const mutations = {
	API_FAILURE(state, error) {
		try {
			let message = error.error.response.data.ocs.meta.message;
			OC.Notification.showHtml(t('settings','An error occured during the request. Unable to proceed.')+'<br>'+message, {timeout: 7});
		} catch(e) {
			OC.Notification.showTemporary(t('settings','An error occured during the request. Unable to proceed.'));
		}
		console.log(state, error);
	}
};

export default new Vuex.Store({
	modules: {
		users,
		settings,
		oc
	},
	strict: debug,

	mutations
});