Skip to content

Commit 52ae213

Browse files
committed
fix(app-store): Add back legacy store API used for update and removal
Signed-off-by: Ferdinand Thiessen <[email protected]>
1 parent d3fd6b9 commit 52ae213

File tree

4 files changed

+24
-17
lines changed

4 files changed

+24
-17
lines changed

apps/settings/src/components/AppList.vue

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,12 @@
140140

141141
<script>
142142
import { subscribe, unsubscribe } from '@nextcloud/event-bus'
143-
import AppItem from './AppList/AppItem.vue'
144143
import pLimit from 'p-limit'
145144
import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
145+
import AppItem from './AppList/AppItem.vue'
146+
import AppManagement from '../mixins/AppManagement'
146147
import { useAppApiStore } from '../store/app-api-store'
148+
import { useAppsStore } from '../store/apps-store'
147149
148150
export default {
149151
name: 'AppList',
@@ -152,6 +154,8 @@ export default {
152154
NcButton,
153155
},
154156
157+
mixins: [AppManagement],
158+
155159
props: {
156160
category: {
157161
type: String,
@@ -161,8 +165,11 @@ export default {
161165
162166
setup() {
163167
const appApiStore = useAppApiStore()
168+
const store = useAppsStore()
169+
164170
return {
165171
appApiStore,
172+
store,
166173
}
167174
},
168175

apps/settings/src/main-apps-users-management.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
*/
55

66
import Vue from 'vue'
7+
import Vuex from 'vuex'
78
import VTooltipPlugin from 'v-tooltip'
89
import { sync } from 'vuex-router-sync'
910
import { t, n } from '@nextcloud/l10n'
@@ -18,14 +19,15 @@ import { PiniaVuePlugin, createPinia } from 'pinia'
1819
// eslint-disable-next-line camelcase
1920
__webpack_nonce__ = getCSPNonce()
2021

21-
const store = useStore()
22-
sync(store, router)
23-
2422
// bind to window
2523
Vue.prototype.t = t
2624
Vue.prototype.n = n
2725
Vue.use(PiniaVuePlugin)
2826
Vue.use(VTooltipPlugin, { defaultHtml: false })
27+
Vue.use(Vuex)
28+
29+
const store = useStore()
30+
sync(store, router)
2931

3032
const pinia = createPinia()
3133

apps/settings/src/mixins/AppManagement.js

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,16 @@ export default {
210210
.catch((error) => { showError(error) })
211211
}
212212
},
213-
remove(appId, removeData = false) {
214-
if (this.app?.app_api) {
215-
this.appApiStore.uninstallApp(appId, removeData)
216-
.then(() => { rebuildNavigation() })
217-
.catch((error) => { showError(error) })
218-
} else {
219-
this.$store.dispatch('appApiApps/uninstallApp', { appId, removeData })
220-
.then((response) => { rebuildNavigation() })
221-
.catch((error) => { showError(error) })
213+
async remove(appId, removeData = false) {
214+
try {
215+
if (this.app?.app_api) {
216+
await this.appApiStore.uninstallApp(appId, removeData)
217+
} else {
218+
await this.$store.dispatch('uninstallApp', { appId, removeData })
219+
}
220+
await rebuildNavigation()
221+
} catch (error) {
222+
showError(error)
222223
}
223224
},
224225
install(appId) {

apps/settings/src/store/index.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,13 @@
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
55

6-
import Vue from 'vue'
7-
import Vuex, { Store } from 'vuex'
6+
import { Store } from 'vuex'
87
import users from './users.js'
98
import apps from './apps.js'
109
import settings from './users-settings.js'
1110
import oc from './oc.js'
1211
import { showError } from '@nextcloud/dialogs'
1312

14-
Vue.use(Vuex)
15-
1613
const debug = process.env.NODE_ENV !== 'production'
1714

1815
const mutations = {

0 commit comments

Comments
 (0)