tambah akses permision button dan keycloak

This commit is contained in:
2025-07-16 12:44:23 +07:00
parent 14dbe01920
commit 43c0aca0c0
43 changed files with 1018 additions and 162 deletions
+13 -7
View File
@@ -3,24 +3,31 @@ import { useSidebarAccess } from "~/composables/sidebarMenu/useSidebarAkses";
import { useHakAksesStore } from "@/stores/sidebarMenuAkses/useMenuAksesStore";
import type { PageAccess } from "~/types/menuAkses/access";
export const useAccess = (pageRoute: string , userRole: string) => {
export const useAccess = (pageRoute: string, userRole: string) => {
//const route = useRoute();
const getRole = userRole;
//const meta = route.path; //halaman yang sedang diakses
const meta = pageRoute
const meta = pageRoute;
// const getPermissions = ['view'] // belum ambil data
const aksesMenu = useHakAksesStore();
//untuk merge akses menu dan akses ke store
const getMenuStore = useSidebarAccess(getRole);
//console.log("masuk akses", getMenuStore);
if (!aksesMenu.role && aksesMenu.mergedSidebar.length === 0) {
//console.log("masuk useSidebarAccess kosong", aksesMenu.$state);
try {
const getMenuStore = useSidebarAccess(getRole);
} catch (error) {
console.log(error);
}
}
//console.log("masuk useSidebarAccess", aksesMenu.$state);
const getPagesUser = aksesMenu.pageAccess;
const getMergedPages = aksesMenu.mergedSidebar;
//const result = useSidebarAccess(getRole);
console.log("route dari useAccess", meta);
//console.log("mergerpage", getMergedPages);meta masih salah
@@ -36,7 +43,6 @@ export const useAccess = (pageRoute: string , userRole: string) => {
}
}
//set permission ke pinia
aksesMenu.setPermissionPage(getPermisionPage);