import type { RouterConfig } from '@nuxt/schema' import type { RouteRecordRaw } from 'vue-router' const emailRouteComponent = () => import('@/pages/apps/email/index.vue') // đ Redirects const redirects: RouteRecordRaw[] = [ // âšī¸ We are redirecting to different pages based on role. // NOTE: Role is just for UI purposes. ACL is based on abilities. { path: '/', name: 'index', redirect: '/login', // Default redirect component: h('div'), }, { path: '/pages/user-profile', name: 'pages-user-profile', redirect: () => ({ name: 'pages-user-profile-tab', params: { tab: 'profile' } }), }, { path: '/pages/account-settings', name: 'pages-account-settings', redirect: () => ({ name: 'pages-account-settings-tab', params: { tab: 'account' } }), }, { path: '/naputpro/beranda', name: 'naputpro-beranda', redirect: () => ({ name: 'naputpro-beranda-tab', params: { tab: 'profile' } }), }, ] const routes: RouteRecordRaw[] = [ // Email filter { path: '/apps/email/filter/:filter', name: 'apps-email-filter', component: emailRouteComponent, meta: { navActiveLink: 'apps-email', layoutWrapperClasses: 'layout-content-height-fixed', }, }, // Email label { path: '/apps/email/label/:label', name: 'apps-email-label', component: emailRouteComponent, meta: { // contentClass: 'email-application', navActiveLink: 'apps-email', layoutWrapperClasses: 'layout-content-height-fixed', }, }, { path: '/dashboards/logistics', name: 'dashboards-logistics', component: () => import('@/pages/apps/logistics/dashboard.vue'), }, { path: '/dashboards/academy', name: 'dashboards-academy', component: () => import('@/pages/apps/academy/dashboard.vue'), }, { path: '/apps/ecommerce/dashboard', name: 'apps-ecommerce-dashboard', component: () => import('@/pages/dashboards/ecommerce.vue'), }, ] // https://router.vuejs.org/api/interfaces/routeroptions.html export default <RouterConfig>{ routes: scannedRoutes => [ ...redirects, ...routes, ...scannedRoutes, ], scrollBehaviorType: 'smooth', scrollBehavior(to) { if (to.hash) return { el: to.hash, behavior: 'smooth', top: 60 } return { top: 0 } }, }