<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',
NcButton,
},
+ mixins: [AppManagement],
+
props: {
category: {
type: String,
setup() {
const appApiStore = useAppApiStore()
+ const store = useAppsStore()
+
return {
appApiStore,
+ store,
}
},
*/
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'
// 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()
.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) {
* 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 = {