fix: #216. setHighlightedNavItemOnLanding
This commit is contained in:
@@ -11,6 +11,8 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import { onBeforeMount, } from 'vue';
|
||||||
|
import { useRouter } from 'vue-router';
|
||||||
import { storeToRefs, mapActions, mapState, } from 'pinia';
|
import { storeToRefs, mapActions, mapState, } from 'pinia';
|
||||||
import LoadingStore from '@/stores/loading.js';
|
import LoadingStore from '@/stores/loading.js';
|
||||||
import AllMapDataStore from '@/stores/allMapData.js';
|
import AllMapDataStore from '@/stores/allMapData.js';
|
||||||
@@ -30,9 +32,26 @@ export default {
|
|||||||
const loadingStore = LoadingStore();
|
const loadingStore = LoadingStore();
|
||||||
const allMapDataStore = AllMapDataStore();
|
const allMapDataStore = AllMapDataStore();
|
||||||
const conformanceStore = ConformanceStore();
|
const conformanceStore = ConformanceStore();
|
||||||
|
const pageAdminStore = PageAdminStore();
|
||||||
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
|
const { tempFilterId, createFilterId, temporaryData, postRuleData, ruleData } = storeToRefs(allMapDataStore);
|
||||||
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } = storeToRefs(conformanceStore);
|
const { conformanceLogTempCheckId, conformanceFilterTempCheckId } = storeToRefs(conformanceStore);
|
||||||
|
const router = useRouter();
|
||||||
|
|
||||||
|
const setHighlightedNavItemOnLanding = () => {
|
||||||
|
const currentPath = router.currentRoute.value.path;
|
||||||
|
const pathSegments = currentPath.split('/').filter(segment => segment !== '');
|
||||||
|
if(pathSegments.length === 1) {
|
||||||
|
if(pathSegments[0] === 'files') {
|
||||||
|
pageAdminStore.setActivePage('ALL');
|
||||||
|
}
|
||||||
|
} else if (pathSegments.length > 1){
|
||||||
|
pageAdminStore.setActivePage(pathSegments[1].toUpperCase());
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
onBeforeMount(() => {
|
||||||
|
setHighlightedNavItemOnLanding();
|
||||||
|
});
|
||||||
return {
|
return {
|
||||||
loadingStore, temporaryData, tempFilterId,
|
loadingStore, temporaryData, tempFilterId,
|
||||||
createFilterId, postRuleData, ruleData,
|
createFilterId, postRuleData, ruleData,
|
||||||
|
|||||||
Reference in New Issue
Block a user