diff --git a/src/_services/app.service.js b/src/_services/app.service.js index e17ed36..94ac696 100644 --- a/src/_services/app.service.js +++ b/src/_services/app.service.js @@ -21,7 +21,8 @@ export const appService = { takeDataAction, getAppConfigViewByUserId, - takeConfigItemAction + takeConfigItemAction, + takeConfigAppAction }; // MITM @@ -92,3 +93,7 @@ function getAppConfigViewByUserId(userId, appId, viewId, messages, errors) { function takeConfigItemAction(userId, appId, viewId, itemId, params, action, messages, errors) { return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}/actions/${action}?id=${itemId}`, util.postWithAuth(params)).then(util.handleCrudResponse(messages, errors)); } + +function takeConfigAppAction(userId, appId, viewId, params, action, messages, errors) { + return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}/actions/${action}`, util.putWithAuth(params)).then(util.handleCrudResponse(messages, errors)); +} diff --git a/src/_store/apps.module.js b/src/_store/apps.module.js index 0fdd77d..08f3dfd 100644 --- a/src/_store/apps.module.js +++ b/src/_store/apps.module.js @@ -171,6 +171,15 @@ const actions = { actionResult => commit('takeConfigItemActionSuccess', actionResult), error => commit('takeConfigItemActionFailure', error) ); + }, + + takeConfigAppAction({ commit }, {userId, appId, viewId, params, action, messages, errors}) { + commit('takeConfigAppActionRequest'); + appService.takeConfigAppAction(userId, appId, viewId, params, action, messages, errors) + .then( + actionResult => commit('takeConfigAppActionSuccess', actionResult), + error => commit('takeConfigAppActionFailure', error) + ); } }; @@ -376,6 +385,18 @@ const mutations = { takeConfigItemActionFailure(state, error) { state.loading.action = false; state.error = error; + }, + + takeConfigAppActionRequest(state) { + state.loading.action = true; + }, + takeConfigAppActionSuccess(state, actionResult) { + state.loading.action = false; + state.actionResult = actionResult; + }, + takeConfigAppActionFailure(state, error) { + state.loading.action = false; + state.error = error; } }; diff --git a/src/account/AppConfigPage.vue b/src/account/AppConfigPage.vue index 113becc..31d58a3 100644 --- a/src/account/AppConfigPage.vue +++ b/src/account/AppConfigPage.vue @@ -5,7 +5,7 @@