feat: initialize Evergreen Health mobile app
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
import { createRouter, createWebHistory } from 'vue-router'
|
||||
import AuthView from './views/AuthView.vue'
|
||||
import OnboardingView from './views/OnboardingView.vue'
|
||||
import DashboardView from './views/DashboardView.vue'
|
||||
import { hasToken } from './services/auth'
|
||||
|
||||
const router = createRouter({
|
||||
history: createWebHistory(),
|
||||
routes: [
|
||||
{ path: '/', redirect: '/dashboard' },
|
||||
{ path: '/auth', component: AuthView, meta: { guest: true } },
|
||||
{ path: '/onboarding', component: OnboardingView },
|
||||
{ path: '/dashboard', component: DashboardView }
|
||||
]
|
||||
})
|
||||
|
||||
router.beforeEach((to) => {
|
||||
if (!to.meta.guest && !hasToken()) return '/auth'
|
||||
if (to.meta.guest && hasToken()) return '/dashboard'
|
||||
})
|
||||
|
||||
export default router
|
||||
Reference in New Issue
Block a user