diff --git a/src/Bones.UI/composables/usePermissions.ts b/src/Bones.UI/composables/usePermissions.ts index fe2e064..f58db58 100644 --- a/src/Bones.UI/composables/usePermissions.ts +++ b/src/Bones.UI/composables/usePermissions.ts @@ -1,26 +1,26 @@ import { ref } from 'vue' const _permissions = ref([]); -const _setted = false; +const _setted = ref(false); export function usePermissions() { const some = (...permissionCodes: string[]) => { - if (!_setted) { + if (!_setted.value) { console.warn("Permissions not setted yet"); } return _permissions.value.some(p => permissionCodes.includes(p)); } const every = (...permissionCodes: string[]) => { - if (!_setted) { + if (!_setted.value) { console.warn("Permissions not setted yet"); } return permissionCodes.every(p => _permissions.value.includes(p)); } const has = (permissionCode: string) => { - if (!_setted) { + if (!_setted.value) { console.warn("Permissions not setted yet"); } return _permissions.value.includes(permissionCode); @@ -28,6 +28,7 @@ export function usePermissions() { const set = (permissions: string[]) => { _permissions.value = permissions; + _setted.value = true; } return {