I am currently in the process of transitioning my existing website to vuejs. The navigation structure I aim for is as follows:
/login
/signup
/password-reset
/browse
/search
... numerous other paths
Since some of these paths have similar functionalities, I decided to group them under parent routes as children:
[{ // public routes
path: '/',
component: Auth,
children: [
{ path: '/login', component: Login },
{ path: '/signup', component: Signup },
{ path: '/password-reset', component: PasswordReset },
]
},
{ // authenticated routes
path: '/',
component: Home,
children: [
{ path: '/browse', component: Browse },
{ path: '/search', component: Search }
]
}]
The issue that arises is clear: both the Auth and Home base components share the same route path which leads to routing errors. Given that there will be a significant number of routes with shared base components and functionalities, I seek to designate them as children of abstract states to avoid conflicts.
Question 1: How can I effectively incorporate these routes along with their parent abstract states without causing conflicts or needing to implement redundant logic in the children components?
Question 2: Is there a way to prevent the parent states from being directly accessible routes, or if they are accessible, automatically redirect to a child state?