tambah akses permision button dan keycloak
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user