diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-04-19 10:30:09 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-16 09:50:22 +0200 |
commit | 0e5b0fcef0d63b4d4c6e3c5f0125b76d8c0088aa (patch) | |
tree | d2f60572022e7f347e0bcbdc756b324ae7c34254 /settings/src/store | |
parent | ff2c23d9e2230960c1712318f452592079b5d2e8 (diff) | |
download | nextcloud-server-0e5b0fcef0d63b4d4c6e3c5f0125b76d8c0088aa.tar.gz nextcloud-server-0e5b0fcef0d63b4d4c6e3c5f0125b76d8c0088aa.zip |
new OC api and default quota fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'settings/src/store')
-rw-r--r-- | settings/src/store/api.js | 14 | ||||
-rw-r--r-- | settings/src/store/index.js | 5 | ||||
-rw-r--r-- | settings/src/store/oc.js | 25 |
3 files changed, 29 insertions, 15 deletions
diff --git a/settings/src/store/api.js b/settings/src/store/api.js index 5ed6d66ef56..7501a7bb4cc 100644 --- a/settings/src/store/api.js +++ b/settings/src/store/api.js @@ -95,19 +95,5 @@ export default { return axios.delete(sanitize(url), { data: data, headers: tokenHeaders.headers }) .then((response) => Promise.resolve(response)) .catch((error) => Promise.reject(error)); - }, - - // OCS API entry points - /** - * - * @param {string} app Application name - * @param {string} key Config key - * @param {string} [value=''] Value to set - * @returns{Promise} - */ - setAppConfig(app, key, value = '') { - return this.requireAdmin().then((response) => { - return this.post(OC.linkToOCS(`apps/provisioning_api/api/v1/config/apps/${app}/${key}`, 2), {value: value}); - }); } };
\ No newline at end of file diff --git a/settings/src/store/index.js b/settings/src/store/index.js index 1fe0c214d51..bf08e4aa390 100644 --- a/settings/src/store/index.js +++ b/settings/src/store/index.js @@ -2,6 +2,7 @@ import Vue from 'vue'; import Vuex from 'vuex'; import users from './users'; import settings from './settings'; +import oc from './oc'; Vue.use(Vuex) @@ -10,13 +11,15 @@ const debug = process.env.NODE_ENV !== 'production'; const mutations = { API_FAILURE(state, error) { console.log(state, error); + OC.Notification.showTemporary(t('settings','An error occured during the request. Unable to proceed.')); } }; export default new Vuex.Store({ modules: { users, - settings + settings, + oc }, strict: debug, diff --git a/settings/src/store/oc.js b/settings/src/store/oc.js new file mode 100644 index 00000000000..4bb82075e8a --- /dev/null +++ b/settings/src/store/oc.js @@ -0,0 +1,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}; |