vue-nuxt-permission
Version:
A unified permission system for Vue 3 and Nuxt 3 / Nuxt 4 with directives, guards, and async support.
21 lines (20 loc) • 807 B
TypeScript
import { PermissionValue } from '../types';
/**
* usePermission Composable
* Reactive + Async + Cached Permission Checker
*
* The returned `permissions` reflects the global reactive state, so any call
* to `configurePermission` or `setPermissions` (from anywhere in the app)
* will be observed automatically.
*/
export declare function usePermission(): {
permissions: import('vue').ComputedRef<string[]>;
can: (rule: PermissionValue) => Promise<boolean>;
hasPermission: (rule: PermissionValue) => Promise<boolean>;
canSync: (rule: PermissionValue) => boolean;
refresh: () => void;
setPermissions: (newPerms: string[]) => void;
hasAll: (perms: string[]) => Promise<boolean>;
hasAny: (perms: string[]) => Promise<boolean>;
};
//# sourceMappingURL=usePermission.d.ts.map