Skip to content

Commit

Permalink
refactor: use redirect to display workflows on initial navigation
Browse files Browse the repository at this point in the history
  • Loading branch information
amtul.noor committed Feb 29, 2024
1 parent 181aa2b commit 307e85b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/router/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ const router = createRouter({
path: '/',
name: 'home',
component: HomeView,
redirect: '/workflows',
children: [
{ path: 'projects', name: 'projects', component: Projects },
{ path: 'processors', name: 'processors', component: Processors },
{ path: 'workflows', alias: '/', name: 'workflows', component: Workflows },
{ path: 'workflows', name: 'workflows', component: Workflows },
],
},
]
Expand Down
3 changes: 1 addition & 2 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const items = ref([
const activeRouteIndex = computed({
get() {
const path = route.path === '/' ? '/workflows' : route.path
return items.value.findIndex(({ to }) => to === path)
return items.value.findIndex(({ to }) => to === route.path)
},
set(index) {
router.push(items.value[index].to)
Expand Down

0 comments on commit 307e85b

Please sign in to comment.