summaryrefslogtreecommitdiffstats
path: root/settings/src/store/oc.js
blob: 4bb82075e8a012bb1f4771fcc4548c5988d71b12 (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
import api from './api';

const state = {};
const mutations = {};
const getters = {};
const actions = {
	/**
     * Set application config in database
     * 
	 * @param {Object} context
     * @param {Object} options
	 * @param {string} options.app Application name
	 * @param {boolean} options.key Config key
	 * @param {boolean} options.value Value to set
	 * @returns{Promise}
	 */
	setAppConfig(context, {app, key, value}) {
		return api.requireAdmin().then((response) => {
			return api.post(OC.linkToOCS(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), {value: value})
				.catch((error) => {throw error;});
		}).catch((error) => context.commit('API_FAILURE', { app, key, value, error }));;
    }
};

export default {state, mutations, getters, actions};