import { ObjectDirective } from 'vue'; import { usePermission } from '@/hooks/web/usePermission'; export const perm: ObjectDirective = { mounted(el: HTMLButtonElement, binding) { if (binding.value == undefined) return; const { action, effect } = binding.value; const { hasSomePermission } = usePermission(); if (!hasSomePermission(binding.value)) { el.parentNode.removeChild(el) } }, }; export const perms: ObjectDirective = { mounted(el: HTMLButtonElement, binding) { if (binding.value == undefined) return; const { action, effect } = binding.value; const { hasEveryPermission } = usePermission(); if (!hasEveryPermission(binding.value)) { el.parentNode.removeChild(el) } }, };