From d67e5e386d7d1901694fe0004f580807754bcae1 Mon Sep 17 00:00:00 2001 From: Dominik Pschenitschni Date: Wed, 21 Sep 2022 14:23:57 +0000 Subject: [PATCH] feat: port label store to pinia | pinia 1/9 (#2391) Co-authored-by: Dominik Pschenitschni Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2391 Reviewed-by: konrad Co-authored-by: Dominik Pschenitschni Co-committed-by: Dominik Pschenitschni --- package.json | 1 + src/components/home/contentAuth.vue | 4 +- src/components/list/partials/filters.vue | 9 +- src/components/tasks/partials/editLabels.vue | 10 +- src/helpers/labels.test.ts | 47 ------- src/helpers/labels.ts | 33 ----- src/main.ts | 4 + src/store/helper.ts | 19 +++ src/store/index.ts | 2 - src/store/modules/labels.ts | 121 ----------------- src/store/modules/tasks.ts | 12 +- src/store/types.ts | 2 +- src/stores/labels.test.ts | 55 ++++++++ src/stores/labels.ts | 136 +++++++++++++++++++ src/views/labels/ListLabels.vue | 32 +++-- src/views/labels/NewLabel.vue | 16 ++- yarn.lock | 8 ++ 17 files changed, 276 insertions(+), 235 deletions(-) delete mode 100644 src/helpers/labels.test.ts delete mode 100644 src/helpers/labels.ts delete mode 100644 src/store/modules/labels.ts create mode 100644 src/stores/labels.test.ts create mode 100644 src/stores/labels.ts diff --git a/package.json b/package.json index 7e5c8bc3..ffb8fe45 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "lodash.debounce": "4.0.8", "marked": "4.1.0", "minimist": "1.2.6", + "pinia": "^2.0.21", "register-service-worker": "1.7.2", "snake-case": "3.0.4", "ufo": "0.8.5", diff --git a/src/components/home/contentAuth.vue b/src/components/home/contentAuth.vue index c4b42015..b41e86e5 100644 --- a/src/components/home/contentAuth.vue +++ b/src/components/home/contentAuth.vue @@ -66,6 +66,7 @@ import {useRoute, useRouter} from 'vue-router' import {useEventListener} from '@vueuse/core' import {CURRENT_LIST, KEYBOARD_SHORTCUTS_ACTIVE, MENU_ACTIVE} from '@/store/mutation-types' +import {useLabelStore} from '@/stores/labels' import Navigation from '@/components/home/navigation.vue' import QuickActions from '@/components/quick-actions/quick-actions.vue' import BaseButton from '@/components/base/BaseButton.vue' @@ -197,7 +198,8 @@ function useRenewTokenOnFocus() { } useRenewTokenOnFocus() -store.dispatch('labels/loadAllLabels') +const labelStore = useLabelStore() +labelStore.loadAllLabels()