-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Kepala only has access list contracts/reports
- Loading branch information
Showing
2 changed files
with
38 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,43 @@ | ||
import ListReportView from '@/views/report/ListReportView.vue'; | ||
import CreateReportView from '@/views/report/CreateReportView.vue'; | ||
import ListReportView from "@/views/report/ListReportView.vue"; | ||
import CreateReportView from "@/views/report/CreateReportView.vue"; | ||
import type { NavigationGuardNext, RouteLocationNormalized } from "vue-router"; | ||
import { useUserStore } from "@/stores/user"; | ||
|
||
const reportRoutes = [ | ||
{ | ||
path: '/bast', | ||
{ | ||
path: "/bast", | ||
meta: { | ||
layout: "LayoutDashboard", | ||
requiresAuth: true, | ||
}, | ||
children: [ | ||
{ | ||
path: "", | ||
name: "listReport", | ||
component: ListReportView, | ||
meta: { | ||
layout: 'LayoutDashboard', | ||
requiresAuth: true | ||
title: "Daftar BAST", | ||
}, | ||
children: [ | ||
{ | ||
path: '', | ||
name: 'listReport', | ||
component: ListReportView, | ||
meta: { | ||
title: "Daftar BAST" | ||
} | ||
}, | ||
{ | ||
path: 'buat', | ||
name: 'createReport', | ||
component: CreateReportView, | ||
meta: { | ||
title: "Buat BAST" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
{ | ||
path: "buat", | ||
name: "createReport", | ||
component: CreateReportView, | ||
meta: { | ||
title: "Buat BAST", | ||
}, | ||
beforeEnter: ( | ||
to: RouteLocationNormalized, | ||
from: RouteLocationNormalized, | ||
next: NavigationGuardNext | ||
) => { | ||
const user = useUserStore(); | ||
if (["KEPALA"].includes(user.position)) next({ name: "unauthorized" }); | ||
else next(); | ||
}, | ||
}, | ||
], | ||
}, | ||
]; | ||
|
||
export default reportRoutes; | ||
export default reportRoutes; |