From dbd4e97f7e0226e848f8a772cb19544096d465e5 Mon Sep 17 00:00:00 2001 From: Abhinav Raut Date: Tue, 9 Sep 2025 23:43:25 +0530 Subject: [PATCH] use tag store to fetch tags in conversation side bar to remove duplicate api call --- .../sidebar/ConversationSideBar.vue | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/frontend/src/features/conversation/sidebar/ConversationSideBar.vue b/frontend/src/features/conversation/sidebar/ConversationSideBar.vue index 91e130b..9b600a8 100644 --- a/frontend/src/features/conversation/sidebar/ConversationSideBar.vue +++ b/frontend/src/features/conversation/sidebar/ConversationSideBar.vue @@ -13,7 +13,9 @@ @@ -22,7 +24,9 @@ @@ -31,7 +35,9 @@ @@ -41,7 +47,9 @@ v-if="conversationStore.current" v-model="conversationStore.current.tags" :items="tags.map((tag) => ({ label: tag, value: tag }))" - :placeholder="t('globals.messages.select', { name: t('globals.terms.tag', 2).toLowerCase() })" + :placeholder=" + t('globals.messages.select', { name: t('globals.terms.tag', 2).toLowerCase() }) + " /> @@ -93,6 +101,7 @@ import { ref, onMounted, watch, computed } from 'vue' import { useConversationStore } from '@/stores/conversation' import { useUsersStore } from '@/stores/users' import { useTeamStore } from '@/stores/team' +import { useTagStore } from '@/stores/tag' import { Accordion, AccordionContent, @@ -118,6 +127,7 @@ const emitter = useEmitter() const conversationStore = useConversationStore() const usersStore = useUsersStore() const teamsStore = useTeamStore() +const tagStore = useTagStore() const tags = ref([]) // Save the accordion state in local storage const accordionState = useStorage('conversation-sidebar-accordion', []) @@ -171,15 +181,8 @@ watch( const priorityOptions = computed(() => conversationStore.priorityOptions) const fetchTags = async () => { - try { - const resp = await api.getTags() - tags.value = resp.data.data.map((item) => item.name) - } catch (error) { - emitter.emit(EMITTER_EVENTS.SHOW_TOAST, { - variant: 'destructive', - description: handleHTTPError(error).message - }) - } + await tagStore.fetchTags() + tags.value = tagStore.tags.map((item) => item.name) } const handleAssignedUserChange = (id) => {