Giant Update regsiter
NPM Installation / build (16.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (16.x, windows-latest) (push) Waiting to run
NPM Installation / build (17.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (17.x, windows-latest) (push) Waiting to run
NPM Installation / build (18.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (18.x, windows-latest) (push) Waiting to run
NPM Installation / build (16.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (16.x, windows-latest) (push) Waiting to run
NPM Installation / build (17.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (17.x, windows-latest) (push) Waiting to run
NPM Installation / build (18.x, ubuntu-latest) (push) Waiting to run
NPM Installation / build (18.x, windows-latest) (push) Waiting to run
This commit is contained in:
+77
-4
@@ -37,7 +37,13 @@ import { hasToken } from '@/utils/session'
|
||||
const routes = [
|
||||
{
|
||||
path: '/',
|
||||
name: 'Home',
|
||||
name: 'Website',
|
||||
component: () => import('@/views/website/LandingPage.vue'),
|
||||
meta: { guestLanding: true },
|
||||
},
|
||||
{
|
||||
path: '/app',
|
||||
name: 'Application',
|
||||
component: DefaultLayout,
|
||||
redirect: '/dashboard',
|
||||
meta: {
|
||||
@@ -58,6 +64,18 @@ const routes = [
|
||||
name: 'Profile',
|
||||
component: () => import('@/views/profile/Profile.vue'),
|
||||
},
|
||||
{
|
||||
path: '/forbidden',
|
||||
name: 'Forbidden',
|
||||
component: () => import('@/views/pages/Page403.vue'),
|
||||
meta: { publicWithinApp: true },
|
||||
},
|
||||
{
|
||||
path: '/my-applications',
|
||||
name: 'Pengajuan Saya',
|
||||
component: () => import('@/views/access-applications/MyApplications.vue'),
|
||||
meta: { publicWithinApp: true },
|
||||
},
|
||||
{
|
||||
path: '/tickets',
|
||||
name: 'Tickets',
|
||||
@@ -539,9 +557,44 @@ const routes = [
|
||||
component: () => import('@/views/payment-gateway/PaymentLogs.vue'),
|
||||
},
|
||||
{
|
||||
path: '/wallet',
|
||||
name: 'Dompet',
|
||||
path: '/deposit-balance',
|
||||
alias: '/wallet',
|
||||
name: 'Saldo Deposit',
|
||||
component: () => import('@/views/wallet/WalletDashboard.vue'),
|
||||
meta: { activeMenu: '/deposit-balance' },
|
||||
},
|
||||
{
|
||||
path: '/voucher-hotspot/sales',
|
||||
name: 'Jual Voucher Hotspot',
|
||||
component: () => import('@/views/voucher-hotspot/VoucherSales.vue'),
|
||||
},
|
||||
{
|
||||
path: '/voucher-hotspot/agents',
|
||||
name: 'Agen Voucher',
|
||||
component: () => import('@/views/voucher-hotspot/VoucherAgents.vue'),
|
||||
},
|
||||
{
|
||||
path: '/voucher-hotspot/login-page',
|
||||
name: 'Voucher LoginPage',
|
||||
component: () => import('@/views/voucher-hotspot/VoucherLoginPage.vue'),
|
||||
},
|
||||
{
|
||||
path: '/access-applications/tenants',
|
||||
name: 'Pengajuan Tenant',
|
||||
component: () => import('@/views/access-applications/ApplicationReviews.vue'),
|
||||
meta: { applicationType: 'tenant' },
|
||||
},
|
||||
{
|
||||
path: '/access-applications/agents',
|
||||
name: 'Pengajuan Agen',
|
||||
component: () => import('@/views/access-applications/ApplicationReviews.vue'),
|
||||
meta: { applicationType: 'agent' },
|
||||
},
|
||||
{
|
||||
path: '/access-applications/staff',
|
||||
name: 'Pengajuan Staff',
|
||||
component: () => import('@/views/access-applications/ApplicationReviews.vue'),
|
||||
meta: { applicationType: 'staff' },
|
||||
},
|
||||
{
|
||||
path: '/users',
|
||||
@@ -661,7 +714,27 @@ router.beforeEach(async (to) => {
|
||||
|
||||
if (requiresAuth) {
|
||||
try {
|
||||
await useMenuStore().fetchMenus()
|
||||
const menuStore = useMenuStore()
|
||||
await menuStore.fetchMenus()
|
||||
|
||||
const publicWithinApp = to.matched.some((record) => record.meta.publicWithinApp)
|
||||
const alwaysAllowed = ['/dashboard', '/profile', '/forbidden', '/my-applications']
|
||||
|
||||
if (!publicWithinApp && !alwaysAllowed.includes(to.path)) {
|
||||
let accessUrl = to.meta.activeMenu || to.path
|
||||
|
||||
if (to.meta.activeMenuBase && to.params.scope) {
|
||||
accessUrl = `${to.meta.activeMenuBase}/${to.params.scope}`
|
||||
}
|
||||
|
||||
if (!menuStore.canAccessUrl(accessUrl)) {
|
||||
return {
|
||||
name: 'Forbidden',
|
||||
query: { from: to.fullPath },
|
||||
replace: true,
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
useAuthStore().logout()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user