From 920e03c16b5913462a61a45417b583504ba25290 Mon Sep 17 00:00:00 2001 From: Jonathan Cobb Date: Sat, 1 Feb 2020 13:20:20 -0500 Subject: [PATCH] WIP. loading app config --- src/_services/app.service.js | 9 ++++++++- src/_store/apps.module.js | 26 ++++++++++++++++++++++++- src/account/AppConfigPage.vue | 36 +++++++++++++++++++++++++++++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) diff --git a/src/_services/app.service.js b/src/_services/app.service.js index 8be18ed..fcda277 100644 --- a/src/_services/app.service.js +++ b/src/_services/app.service.js @@ -18,7 +18,9 @@ export const appService = { getAppDataByUserId, getAppSiteDataByUserId, - takeDataAction + takeDataAction, + + getAppConfigViewByUserId }; // MITM @@ -80,3 +82,8 @@ function getAppSiteDataByUserId(userId, appId, siteId, viewId, query, messages, function takeDataAction(userId, appId, dataId, action, messages, errors) { return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/data/${dataId}/actions/${action}`, util.postWithAuth()).then(util.handleCrudResponse(messages, errors)); } + +// Config +function getAppConfigViewByUserId(userId, appId, viewId, messages, errors) { + return fetch(`${config.apiUrl}/users/${userId}/apps/${appId}/config/${viewId}`, util.getWithAuth()).then(util.handleCrudResponse(messages, errors)); +} diff --git a/src/_store/apps.module.js b/src/_store/apps.module.js index 239d44b..8759625 100644 --- a/src/_store/apps.module.js +++ b/src/_store/apps.module.js @@ -6,7 +6,7 @@ const state = { enableMitm: false, disableMitm: false, apps: false, app: false, enableApp: false, disableApp: false, sites: false, site: false, enableSite: false, disableSite: false, - appData: false, action: false + appData: false, appConfig: false, action: false }, mitmEnabled: null, error: null, @@ -15,6 +15,7 @@ const state = { sites: [], site: null, appData: null, + appConfigData: null, actionResult: null }; @@ -151,6 +152,16 @@ const actions = { appData => commit('takeDataActionSuccess', appData), error => commit('takeDataActionFailure', error) ); + }, + + // App Config + getAppConfigViewByUserId({ commit }, {userId, appId, viewId, messages, errors}) { + commit('getAppConfigViewByUserIdRequest'); + appService.getAppConfigViewByUserId(userId, appId, viewId, messages, errors) + .then( + appConfigData => commit('getAppConfigViewByUserIdSuccess', appConfigData), + error => commit('getAppConfigViewByUserIdFailure', error) + ); } }; @@ -331,6 +342,19 @@ const mutations = { takeDataActionFailure(state, error) { state.loading.action = false; state.error = error; + }, + + // App Config + getAppConfigViewByUserIdRequest(state) { + state.loading.appConfig = true; + }, + getAppConfigViewByUserIdSuccess(state, appConfigData) { + state.loading.appConfig = false; + state.appConfigData = appConfigData; + }, + getAppConfigViewByUserIdFailure(state, error) { + state.loading.appConfig = false; + state.error = error; } }; diff --git a/src/account/AppConfigPage.vue b/src/account/AppConfigPage.vue index be6f296..7d5cf47 100644 --- a/src/account/AppConfigPage.vue +++ b/src/account/AppConfigPage.vue @@ -6,13 +6,49 @@ \ No newline at end of file