38 lines
751 B
TypeScript
Raw Normal View History

2025-10-21 01:14:13 +07:00
import * as Page from '@/views'
import { getToken } from '@/helpers'
const ifAuthenticated = (to: any, from: any, next: any) => {
if (getToken()) {
next()
return
}
next('/login')
}
const ifNotAuthenticated = (to: any, from: any, next: any) => {
if (!getToken()) {
next()
return
}
next('/')
}
export const routes: any = [
{
path: '/',
redirect: '/home',
children: [
{
path: 'home',
name: 'home',
component: Page.Home,
},
{
path: ':pathMatch(.*)*',
component: Page.NotFound,
name: 'page-not-found',
},
],
},
]