From 4495c02c41b95ce6df0c34dbf6ac62f7addae7a3 Mon Sep 17 00:00:00 2001 From: Leonardo Bishop Date: Sun, 10 Mar 2024 01:01:22 +0000 Subject: Move selected state out of store and into route --- components/Editor/EditorSidebarCategory.vue | 22 ++++++++++++---------- components/Editor/EditorSidebarQuest.vue | 18 +++++++++--------- 2 files changed, 21 insertions(+), 19 deletions(-) (limited to 'components') diff --git a/components/Editor/EditorSidebarCategory.vue b/components/Editor/EditorSidebarCategory.vue index 7153b92..071ebc8 100644 --- a/components/Editor/EditorSidebarCategory.vue +++ b/components/Editor/EditorSidebarCategory.vue @@ -13,6 +13,7 @@ const { category } = toRefs(props); const expanded = ref(true); const sessionStore = useSessionStore(); +const route = useRoute(); const questsInCategory = computed(() => { return sessionStore.getQuestsInCategory(category.value.id); @@ -23,21 +24,22 @@ const expandCategory = () => { }; const setSelectedCategory = () => { - sessionStore.setEditorSelected('Category', category.value.id); + navigateTo({ path: `/category/${category.value.id}` }) }; const selected = computed(() => { - return sessionStore.editor.selected.type === 'Category' && sessionStore.editor.selected.id === category.value.id; + return route.path.startsWith('/category') && route.params.id === category.value.id; });