diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-11 19:33:50 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-11-11 21:52:31 +0100 |
commit | 52ae2134da5ff916a5bd598e7bd9b5f9f3c0670e (patch) | |
tree | 97cd9bde874437720bfd4cfc1a2f6032ffc4e818 /apps/settings/src | |
parent | d3fd6b934fc551cad199eeedc905638d5b7cb992 (diff) | |
download | nextcloud-server-52ae2134da5ff916a5bd598e7bd9b5f9f3c0670e.tar.gz nextcloud-server-52ae2134da5ff916a5bd598e7bd9b5f9f3c0670e.zip |
fix(app-store): Add back legacy store API used for update and removal
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/settings/src')
-rw-r--r-- | apps/settings/src/components/AppList.vue | 9 | ||||
-rw-r--r-- | apps/settings/src/main-apps-users-management.ts | 8 | ||||
-rw-r--r-- | apps/settings/src/mixins/AppManagement.js | 19 | ||||
-rw-r--r-- | apps/settings/src/store/index.js | 5 |
4 files changed, 24 insertions, 17 deletions
diff --git a/apps/settings/src/components/AppList.vue b/apps/settings/src/components/AppList.vue index 9a676034636..8271fc6f271 100644 --- a/apps/settings/src/components/AppList.vue +++ b/apps/settings/src/components/AppList.vue @@ -140,10 +140,12 @@ <script> import { subscribe, unsubscribe } from '@nextcloud/event-bus' -import AppItem from './AppList/AppItem.vue' import pLimit from 'p-limit' import NcButton from '@nextcloud/vue/dist/Components/NcButton.js' +import AppItem from './AppList/AppItem.vue' +import AppManagement from '../mixins/AppManagement' import { useAppApiStore } from '../store/app-api-store' +import { useAppsStore } from '../store/apps-store' export default { name: 'AppList', @@ -152,6 +154,8 @@ export default { NcButton, }, + mixins: [AppManagement], + props: { category: { type: String, @@ -161,8 +165,11 @@ export default { setup() { const appApiStore = useAppApiStore() + const store = useAppsStore() + return { appApiStore, + store, } }, diff --git a/apps/settings/src/main-apps-users-management.ts b/apps/settings/src/main-apps-users-management.ts index f24562d3e82..62ea009de11 100644 --- a/apps/settings/src/main-apps-users-management.ts +++ b/apps/settings/src/main-apps-users-management.ts @@ -4,6 +4,7 @@ */ import Vue from 'vue' +import Vuex from 'vuex' import VTooltipPlugin from 'v-tooltip' import { sync } from 'vuex-router-sync' import { t, n } from '@nextcloud/l10n' @@ -18,14 +19,15 @@ import { PiniaVuePlugin, createPinia } from 'pinia' // eslint-disable-next-line camelcase __webpack_nonce__ = getCSPNonce() -const store = useStore() -sync(store, router) - // bind to window Vue.prototype.t = t Vue.prototype.n = n Vue.use(PiniaVuePlugin) Vue.use(VTooltipPlugin, { defaultHtml: false }) +Vue.use(Vuex) + +const store = useStore() +sync(store, router) const pinia = createPinia() diff --git a/apps/settings/src/mixins/AppManagement.js b/apps/settings/src/mixins/AppManagement.js index 788a0d63168..893939bc264 100644 --- a/apps/settings/src/mixins/AppManagement.js +++ b/apps/settings/src/mixins/AppManagement.js @@ -210,15 +210,16 @@ export default { .catch((error) => { showError(error) }) } }, - remove(appId, removeData = false) { - if (this.app?.app_api) { - this.appApiStore.uninstallApp(appId, removeData) - .then(() => { rebuildNavigation() }) - .catch((error) => { showError(error) }) - } else { - this.$store.dispatch('appApiApps/uninstallApp', { appId, removeData }) - .then((response) => { rebuildNavigation() }) - .catch((error) => { showError(error) }) + async remove(appId, removeData = false) { + try { + if (this.app?.app_api) { + await this.appApiStore.uninstallApp(appId, removeData) + } else { + await this.$store.dispatch('uninstallApp', { appId, removeData }) + } + await rebuildNavigation() + } catch (error) { + showError(error) } }, install(appId) { diff --git a/apps/settings/src/store/index.js b/apps/settings/src/store/index.js index 910185edb51..9ecda7e37ad 100644 --- a/apps/settings/src/store/index.js +++ b/apps/settings/src/store/index.js @@ -3,16 +3,13 @@ * SPDX-License-Identifier: AGPL-3.0-or-later */ -import Vue from 'vue' -import Vuex, { Store } from 'vuex' +import { Store } from 'vuex' import users from './users.js' import apps from './apps.js' import settings from './users-settings.js' import oc from './oc.js' import { showError } from '@nextcloud/dialogs' -Vue.use(Vuex) - const debug = process.env.NODE_ENV !== 'production' const mutations = { |