diff --git a/src/store/modules/orderRouting/getters.ts b/src/store/modules/orderRouting/getters.ts index 7271f81..85a27fd 100644 --- a/src/store/modules/orderRouting/getters.ts +++ b/src/store/modules/orderRouting/getters.ts @@ -1,6 +1,7 @@ import { GetterTree } from "vuex" import OrderRoutingState from "./OrderRoutingState" import RootState from "@/store/RootState" +import { Group } from "@/types" const getters: GetterTree = { getRoutingGroups(state) { @@ -8,6 +9,10 @@ const getters: GetterTree = { }, getOrderRoutings(state) { return state.routes + }, + getCurrentRoutingGroup(state) { + const currentRoutingGroup = state.groups?.find((group: Group) => group.routingGroupId === state.currentGroupId) + return currentRoutingGroup ? currentRoutingGroup : {} } } diff --git a/src/views/BrokeringRoute.vue b/src/views/BrokeringRoute.vue index dab2eea..0a9aeda 100644 --- a/src/views/BrokeringRoute.vue +++ b/src/views/BrokeringRoute.vue @@ -43,7 +43,7 @@ - {{ "This is what a long description of the routing rule that the user has created looks like. This also includes an edit button where the user can edit their description inline" }} + {{ currentRoutingGroup.description ? currentRoutingGroup.description : "No description available" }} @@ -57,19 +57,19 @@ {{ "Run time" }} - {{ "3:00 PM EST" }} + {{ "Schedule" }} - {{ "Every 5 minutes" }} + - {{ "Created at - {{ "Updated at @@ -84,6 +84,7 @@ import { addCircleOutline, timeOutline, timerOutline } from "ionicons/icons" import { useRouter } from "vue-router"; import { useStore } from "vuex"; import { computed, defineProps } from "vue"; +import { Group } from "@/types"; const router = useRouter(); const store = useStore(); @@ -94,10 +95,16 @@ const props = defineProps({ } }) +const currentRoutingGroup = computed((): Group => store.getters["orderRouting/getCurrentRoutingGroup"]) const orderRoutings = computed(() => store.getters["orderRouting/getOrderRoutings"]) onIonViewWillEnter(async () => { - await store.dispatch('orderRouting/fetchOrderRoutings', props.routingGroupId) + await store.dispatch("orderRouting/fetchOrderRoutings", props.routingGroupId) + + // On refresh, the groups list is removed thus resulting is not fetching the current group information + if(!currentRoutingGroup.value.routingGroupId) { + await store.dispatch("orderRouting/fetchOrderRoutingGroups") + } })