Skip to content

Commit

Permalink
fix: finding current Tab[WTEL-4296]
Browse files Browse the repository at this point in the history
  • Loading branch information
Lera24 committed Mar 19, 2024
1 parent 046b323 commit 534a920
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,21 +69,12 @@ const tabs = computed(() => [
},
]);
const currentTab = ref({});
const currentTab = computed(() => tabs.value.find(({ pathName }) => pathName === route.name))
function changeTab(tab) {
currentTab.value = tab;
return router.push({ name: tab.pathName });
}
function initializeCommunicationsTab() {
currentTab.value = tabs.value.find(({ pathName }) => pathName === route.name)
}
onMounted(() => {
initializeCommunicationsTab();
});
</script>

<style lang="scss" scoped>
Expand Down
13 changes: 1 addition & 12 deletions src/modules/contacts/components/opened-contact-tabs.vue
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,12 @@ const tabs = computed(() => [
]);
const currentTab = computed(() => {
if(route?.name?.includes('communications')) {
return tabs.value.find(tab => tab.value === 'communications')
}
return tabs.value.find(({ pathName }) => pathName === route.name)
return tabs.value.find(({ pathName }) => route?.matched?.find(({name}) => name === pathName));
});
function changeTab(tab) {
return router.push({ name: tab.pathName });
}
function initializeTab() {
if (!currentTab.value) changeTab(tabs.value[0]);
}
onMounted(() => {
initializeTab();
});
</script>
<style lang="scss" scoped>
Expand Down

0 comments on commit 534a920

Please sign in to comment.