]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(app-store): Add back legacy store API used for update and removal
authorFerdinand Thiessen <opensource@fthiessen.de>
Mon, 11 Nov 2024 18:33:50 +0000 (19:33 +0100)
committerFerdinand Thiessen <opensource@fthiessen.de>
Mon, 11 Nov 2024 20:52:31 +0000 (21:52 +0100)
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
apps/settings/src/components/AppList.vue
apps/settings/src/main-apps-users-management.ts
apps/settings/src/mixins/AppManagement.js
apps/settings/src/store/index.js

index 9a676034636caf5f038908bf5a37081cfe29ae72..8271fc6f271e8da610554ea0748fece63f51f31d 100644 (file)
 
 <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,
                }
        },
 
index f24562d3e82b6648a48f5cca4cf008795f7dc4f0..62ea009de11e588d25d753148cd624bf0c216634 100644 (file)
@@ -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()
 
index 788a0d631688634bb75159191671f9893be0693c..893939bc2649ab19c87abb2136bdd29ae428d1d8 100644 (file)
@@ -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) {
index 910185edb5107141cc15d7023e75ed9adf85e7ef..9ecda7e37ad8e2568d8e399bc07a63cbabe328e8 100644 (file)
@@ -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 = {