diff --git a/src/components/sidebar/Sidebar.vue b/src/components/sidebar/Sidebar.vue
index e788034..7e5cf1b 100644
--- a/src/components/sidebar/Sidebar.vue
+++ b/src/components/sidebar/Sidebar.vue
@@ -24,7 +24,7 @@
BAST
Daftar BAST
- Buat BAST
+ Buat BAST
diff --git a/src/router/reportRoute.ts b/src/router/reportRoute.ts
index 0444da1..80ad5dc 100644
--- a/src/router/reportRoute.ts
+++ b/src/router/reportRoute.ts
@@ -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;
\ No newline at end of file
+export default reportRoutes;