diff --git a/src/init-dashboard.js b/src/init-dashboard.js
index 7abf2e4034..86a3695dd0 100644
--- a/src/init-dashboard.js
+++ b/src/init-dashboard.js
@@ -17,23 +17,21 @@ const getAsyncImports = async () => {
}
const { default: Vue } = await import('vue')
+ const { createPinia, PiniaVuePlugin } = await import('pinia')
const { default: Vuex } = await import('vuex')
- const { default: dashboard } = await import('./store/dashboard.js')
Vue.prototype.t = t
Vue.prototype.n = n
Vue.prototype.OC = OC
+ const pinia = createPinia()
+ Vue.use(PiniaVuePlugin)
Vue.use(Vuex)
-
const store = new Vuex.Store({
- modules: {
- dashboard,
- },
strict: debug,
})
_imports = {
- store, Vue,
+ pinia, Vue, store,
}
return _imports
@@ -41,34 +39,37 @@ const getAsyncImports = async () => {
document.addEventListener('DOMContentLoaded', () => {
OCA.Dashboard.register('deck', async (el) => {
- const { Vue, store } = await getAsyncImports()
+ const { Vue, pinia, store } = await getAsyncImports()
const { default: DashboardUpcoming } = await import('./views/DashboardUpcoming.vue')
const View = Vue.extend(DashboardUpcoming)
const vm = new View({
propsData: {},
+ pinia,
store,
}).$mount(el)
return vm
})
OCA.Dashboard.register('deckToday', async (el) => {
- const { Vue, store } = await getAsyncImports()
+ const { Vue, pinia, store } = await getAsyncImports()
const { default: DashboardToday } = await import('./views/DashboardToday.vue')
const View = Vue.extend(DashboardToday)
const vm = new View({
propsData: {},
+ pinia,
store,
}).$mount(el)
return vm
})
OCA.Dashboard.register('deckTomorrow', async (el) => {
- const { Vue, store } = await getAsyncImports()
+ const { Vue, pinia, store } = await getAsyncImports()
const { default: DashboardTomorrow } = await import('./views/DashboardTomorrow.vue')
const View = Vue.extend(DashboardTomorrow)
const vm = new View({
propsData: {},
+ pinia,
store,
}).$mount(el)
return vm
diff --git a/src/store/dashboard.js b/src/store/dashboard.js
deleted file mode 100644
index f316410b61..0000000000
--- a/src/store/dashboard.js
+++ /dev/null
@@ -1,34 +0,0 @@
-/**
- * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
- * SPDX-License-Identifier: AGPL-3.0-or-later
- */
-
-import Vue from 'vue'
-import Vuex from 'vuex'
-import { OverviewApi } from '../services/OverviewApi.js'
-
-Vue.use(Vuex)
-
-const apiClient = new OverviewApi()
-
-export default {
- state: {
- assignedCards: [],
- },
- getters: {
- assignedCardsDashboard: state => {
- return state.assignedCards
- },
- },
- mutations: {
- setAssignedCards(state, assignedCards) {
- state.assignedCards = assignedCards
- },
- },
- actions: {
- async loadUpcoming({ commit }) {
- const upcommingCards = await apiClient.get('upcoming')
- commit('setAssignedCards', upcommingCards)
- },
- },
-}
diff --git a/src/stores/dashboard.js b/src/stores/dashboard.js
new file mode 100644
index 0000000000..9e417a29ab
--- /dev/null
+++ b/src/stores/dashboard.js
@@ -0,0 +1,21 @@
+/**
+ * SPDX-FileCopyrightText: 2026 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-License-Identifier: AGPL-3.0-or-later
+ */
+
+import { defineStore } from 'pinia'
+import { OverviewApi } from '../services/OverviewApi.js'
+
+const apiClient = new OverviewApi()
+
+export const useDashboardStore = defineStore('dashboard', {
+ state: () => ({
+ assignedCards: [],
+ }),
+ actions: {
+ async loadUpcoming() {
+ const upcommingCards = await apiClient.get('upcoming')
+ this.assignedCards = upcommingCards
+ },
+ },
+})
diff --git a/src/views/DashboardToday.vue b/src/views/DashboardToday.vue
index 58ab61b65f..f6f73f7f6f 100644
--- a/src/views/DashboardToday.vue
+++ b/src/views/DashboardToday.vue
@@ -20,9 +20,10 @@
diff --git a/src/views/DashboardTomorrow.vue b/src/views/DashboardTomorrow.vue
index 3996a695ab..4271bf9c9c 100644
--- a/src/views/DashboardTomorrow.vue
+++ b/src/views/DashboardTomorrow.vue
@@ -20,9 +20,10 @@
diff --git a/src/views/DashboardUpcoming.vue b/src/views/DashboardUpcoming.vue
index 4623ea58f1..51dad7ff8f 100644
--- a/src/views/DashboardUpcoming.vue
+++ b/src/views/DashboardUpcoming.vue
@@ -33,10 +33,11 @@