diff --git a/src/components/home/navigation.vue b/src/components/home/navigation.vue
index 2e594771..f7f8f7f2 100644
--- a/src/components/home/navigation.vue
+++ b/src/components/home/navigation.vue
@@ -160,6 +160,7 @@ import type {IList} from '@/modelTypes/IList'
import type {INamespace} from '@/modelTypes/INamespace'
import ColorBubble from '@/components/misc/colorBubble.vue'
import {useListStore} from '@/stores/lists'
+import {useNamespaceStore} from '@/stores/namespaces'
const drag = ref(false)
const dragOptions = {
@@ -168,13 +169,14 @@ const dragOptions = {
}
const store = useStore()
+const namespaceStore = useNamespaceStore()
const currentList = computed(() => store.state.currentList)
const menuActive = computed(() => store.state.menuActive)
-const loading = computed(() => store.state.loading && store.state.loadingModule === 'namespaces')
+const loading = computed(() => namespaceStore.isLoading)
const namespaces = computed(() => {
- return (store.state.namespaces.namespaces as INamespace[]).filter(n => !n.isArchived)
+ return namespaceStore.namespaces.filter(n => !n.isArchived)
})
const activeLists = computed(() => {
return namespaces.value.map(({lists}) => {
@@ -210,7 +212,7 @@ function toggleLists(namespaceId: INamespace['id']) {
const listsVisible = ref<{ [id: INamespace['id']]: boolean }>({})
// FIXME: async action will be unfinished when component mounts
onBeforeMount(async () => {
- const namespaces = await store.dispatch('namespaces/loadNamespaces') as INamespace[]
+ const namespaces = await namespaceStore.loadNamespaces()
namespaces.forEach(n => {
if (typeof listsVisible.value[n.id] === 'undefined') {
listsVisible.value[n.id] = true
@@ -229,7 +231,7 @@ function updateActiveLists(namespace: INamespace, activeLists: IList[]) {
...namespace.lists.filter(l => l.isArchived),
]
- store.commit('namespaces/setNamespaceById', {
+ namespaceStore.setNamespaceById({
...namespace,
lists,
})
diff --git a/src/components/tasks/partials/listSearch.vue b/src/components/tasks/partials/listSearch.vue
index 4a5e1b2e..9ac59d66 100644
--- a/src/components/tasks/partials/listSearch.vue
+++ b/src/components/tasks/partials/listSearch.vue
@@ -19,12 +19,12 @@
diff --git a/src/views/list/settings/duplicate.vue b/src/views/list/settings/duplicate.vue
index e4ed6072..bb784a8a 100644
--- a/src/views/list/settings/duplicate.vue
+++ b/src/views/list/settings/duplicate.vue
@@ -22,7 +22,6 @@
@@ -21,11 +21,12 @@ import {ref, computed, watch, shallowReactive} from 'vue'
import {useI18n} from 'vue-i18n'
import {useRouter} from 'vue-router'
-import {useStore} from '@/store'
import {useTitle} from '@/composables/useTitle'
import {success} from '@/message'
+import {useNamespaceStore} from '@/stores/namespaces'
import NamespaceModel from '@/models/namespace'
import NamespaceService from '@/services/namespace'
+import type { INamespace } from '@/modelTypes/INamespace'
const props = defineProps({
namespaceId: {
@@ -34,17 +35,17 @@ const props = defineProps({
},
})
-const store = useStore()
-const router = useRouter()
const {t} = useI18n({useScope: 'global'})
+const router = useRouter()
+const namespaceStore = useNamespaceStore()
const namespaceService = shallowReactive(new NamespaceService())
-const namespace = ref(new NamespaceModel())
+const namespace = ref(new NamespaceModel())
watch(
() => props.namespaceId,
async () => {
- namespace.value = store.getters['namespaces/getNamespaceById'](props.namespaceId)
+ namespace.value = namespaceStore.getNamespaceById(props.namespaceId) || new NamespaceModel()
// FIXME: ressouce should be loaded in store
namespace.value = await namespaceService.get({id: props.namespaceId})
@@ -61,7 +62,7 @@ const title = computed(() => {
useTitle(title)
async function deleteNamespace() {
- await store.dispatch('namespaces/deleteNamespace', namespace.value)
+ await namespaceStore.deleteNamespace(namespace.value)
success({message: t('namespace.delete.success')})
router.push({name: 'home'})
}
diff --git a/src/views/namespaces/settings/edit.vue b/src/views/namespaces/settings/edit.vue
index 60596b28..2365f331 100644
--- a/src/views/namespaces/settings/edit.vue
+++ b/src/views/namespaces/settings/edit.vue
@@ -57,7 +57,6 @@