Skip to content

Commit

Permalink
fix(settings): stop reloading after force-enabling an app
Browse files Browse the repository at this point in the history
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
  • Loading branch information
skjnldsv committed Jan 31, 2024
1 parent f629e54 commit ffae800
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
14 changes: 12 additions & 2 deletions apps/settings/src/store/apps.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
Expand All @@ -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 }) {
Expand Down
4 changes: 2 additions & 2 deletions dist/settings-vue-settings-apps-users-management.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/settings-vue-settings-apps-users-management.js.map

Large diffs are not rendered by default.

0 comments on commit ffae800

Please sign in to comment.