Add watcher in agent view for route changes and set new active agent. Fixes #1110

This commit is contained in:
sadnub 2022-05-14 22:23:03 -04:00
parent 809e172280
commit 6ff591427a
1 changed files with 11 additions and 3 deletions

View File

@ -20,7 +20,7 @@
<script>
// composition imports
import { ref } from "vue";
import { defineComponent, ref, watch } from "vue";
import { useStore } from "vuex";
import { useRoute } from "vue-router";
import { useQuasar } from "quasar";
@ -29,7 +29,7 @@ import { useQuasar } from "quasar";
import SummaryTab from "@/components/agents/SummaryTab";
import SubTableTabs from "@/components/SubTableTabs";
export default {
export default defineComponent({
name: "AgentView",
components: {
SummaryTab,
@ -51,9 +51,17 @@ export default {
store.commit("setActiveRow", route.params.agent_id);
store.state.tabHeight = `${tabHeight.value}px`;
// watch for route change
watch(
() => route.params.agent_id,
() => {
store.commit("setActiveRow", route.params.agent_id);
}
);
return {
tabHeight,
};
},
};
});
</script>