diff options
Diffstat (limited to 'apps/settings')
-rw-r--r-- | apps/settings/src/store/apps.js | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/apps/settings/src/store/apps.js b/apps/settings/src/store/apps.js index 86ac15f69a2..d1c5be8034f 100644 --- a/apps/settings/src/store/apps.js +++ b/apps/settings/src/store/apps.js @@ -90,6 +90,13 @@ const mutations = { app.groups = groups }, + setInstallState(state, { appId, canInstall }) { + const app = state.apps.find(app => app.id === appId) + if (app) { + app.canInstall = canInstall === true + } + }, + disableApp(state, appId) { const app = state.apps.find(app => app.id === appId) app.active = false @@ -237,8 +244,7 @@ const actions = { context.commit('startLoading', 'install') return api.post(generateUrl('settings/apps/force'), { appId }) .then((response) => { - // TODO: find a cleaner solution - location.reload() + context.commit('setInstallState', { appId, canInstall: true }) }) .catch((error) => { context.commit('stopLoading', apps) @@ -249,6 +255,10 @@ const actions = { }) context.commit('APPS_API_FAILURE', { appId, error }) }) + .finally(() => { + context.commit('stopLoading', apps) + context.commit('stopLoading', 'install') + }) }).catch((error) => context.commit('API_FAILURE', { appId, error })) }, disableApp(context, { appId }) { |