mirror of
https://github.com/abhinavxd/libredesk.git
synced 2025-11-03 21:43:35 +00:00
use tag store to fetch tags in conversation side bar to remove duplicate api call
This commit is contained in:
@@ -13,7 +13,9 @@
|
|||||||
<SelectComboBox
|
<SelectComboBox
|
||||||
v-model="conversationStore.current.assigned_user_id"
|
v-model="conversationStore.current.assigned_user_id"
|
||||||
:items="[{ value: 'none', label: 'None' }, ...usersStore.options]"
|
:items="[{ value: 'none', label: 'None' }, ...usersStore.options]"
|
||||||
:placeholder="t('globals.messages.select', { name: t('globals.terms.agent').toLowerCase() })"
|
:placeholder="
|
||||||
|
t('globals.messages.select', { name: t('globals.terms.agent').toLowerCase() })
|
||||||
|
"
|
||||||
@select="selectAgent"
|
@select="selectAgent"
|
||||||
type="user"
|
type="user"
|
||||||
/>
|
/>
|
||||||
@@ -22,7 +24,9 @@
|
|||||||
<SelectComboBox
|
<SelectComboBox
|
||||||
v-model="conversationStore.current.assigned_team_id"
|
v-model="conversationStore.current.assigned_team_id"
|
||||||
:items="[{ value: 'none', label: 'None' }, ...teamsStore.options]"
|
:items="[{ value: 'none', label: 'None' }, ...teamsStore.options]"
|
||||||
:placeholder="t('globals.messages.select', { name: t('globals.terms.team').toLowerCase() })"
|
:placeholder="
|
||||||
|
t('globals.messages.select', { name: t('globals.terms.team').toLowerCase() })
|
||||||
|
"
|
||||||
@select="selectTeam"
|
@select="selectTeam"
|
||||||
type="team"
|
type="team"
|
||||||
/>
|
/>
|
||||||
@@ -31,7 +35,9 @@
|
|||||||
<SelectComboBox
|
<SelectComboBox
|
||||||
v-model="conversationStore.current.priority_id"
|
v-model="conversationStore.current.priority_id"
|
||||||
:items="priorityOptions"
|
:items="priorityOptions"
|
||||||
:placeholder="t('globals.messages.select', { name: t('globals.terms.priority').toLowerCase() })"
|
:placeholder="
|
||||||
|
t('globals.messages.select', { name: t('globals.terms.priority').toLowerCase() })
|
||||||
|
"
|
||||||
@select="selectPriority"
|
@select="selectPriority"
|
||||||
type="priority"
|
type="priority"
|
||||||
/>
|
/>
|
||||||
@@ -41,7 +47,9 @@
|
|||||||
v-if="conversationStore.current"
|
v-if="conversationStore.current"
|
||||||
v-model="conversationStore.current.tags"
|
v-model="conversationStore.current.tags"
|
||||||
:items="tags.map((tag) => ({ label: tag, value: tag }))"
|
: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() })
|
||||||
|
"
|
||||||
/>
|
/>
|
||||||
</AccordionContent>
|
</AccordionContent>
|
||||||
</AccordionItem>
|
</AccordionItem>
|
||||||
@@ -93,6 +101,7 @@ import { ref, onMounted, watch, computed } from 'vue'
|
|||||||
import { useConversationStore } from '@/stores/conversation'
|
import { useConversationStore } from '@/stores/conversation'
|
||||||
import { useUsersStore } from '@/stores/users'
|
import { useUsersStore } from '@/stores/users'
|
||||||
import { useTeamStore } from '@/stores/team'
|
import { useTeamStore } from '@/stores/team'
|
||||||
|
import { useTagStore } from '@/stores/tag'
|
||||||
import {
|
import {
|
||||||
Accordion,
|
Accordion,
|
||||||
AccordionContent,
|
AccordionContent,
|
||||||
@@ -118,6 +127,7 @@ const emitter = useEmitter()
|
|||||||
const conversationStore = useConversationStore()
|
const conversationStore = useConversationStore()
|
||||||
const usersStore = useUsersStore()
|
const usersStore = useUsersStore()
|
||||||
const teamsStore = useTeamStore()
|
const teamsStore = useTeamStore()
|
||||||
|
const tagStore = useTagStore()
|
||||||
const tags = ref([])
|
const tags = ref([])
|
||||||
// Save the accordion state in local storage
|
// Save the accordion state in local storage
|
||||||
const accordionState = useStorage('conversation-sidebar-accordion', [])
|
const accordionState = useStorage('conversation-sidebar-accordion', [])
|
||||||
@@ -171,15 +181,8 @@ watch(
|
|||||||
const priorityOptions = computed(() => conversationStore.priorityOptions)
|
const priorityOptions = computed(() => conversationStore.priorityOptions)
|
||||||
|
|
||||||
const fetchTags = async () => {
|
const fetchTags = async () => {
|
||||||
try {
|
await tagStore.fetchTags()
|
||||||
const resp = await api.getTags()
|
tags.value = tagStore.tags.map((item) => item.name)
|
||||||
tags.value = resp.data.data.map((item) => item.name)
|
|
||||||
} catch (error) {
|
|
||||||
emitter.emit(EMITTER_EVENTS.SHOW_TOAST, {
|
|
||||||
variant: 'destructive',
|
|
||||||
description: handleHTTPError(error).message
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const handleAssignedUserChange = (id) => {
|
const handleAssignedUserChange = (id) => {
|
||||||
|
|||||||
Reference in New Issue
Block a user