Demo

useAllowedAPIPermission

Cached allowed-API permission store used by Protected and permission checks. Import from @quan-erp/base-frontend. Double-call: useAllowedAPIPermission()().

Signature

TSsignature
function useAllowedAPIPermission(): () => AllowedAPIPermissionStore; // APINames value: 'allowed-api-permission'

Key API

  • checkIsAllowAPI(apiName) — whether the signed-in role may call an API
  • Cache is filled by the shell after login / permission refresh
  • Works with <Protected requiredApis={[…]}> from the permission system

Usage

TSXcheck
import { useAllowedAPIPermission } from "@quan-erp/base-frontend"; const permission = useAllowedAPIPermission()(); const canCreate = permission.checkIsAllowAPI("my-plugin.create");

Notes

  • Double-call required
  • Prefer <Protected> for UI gating when possible
  • See Frontend → Core → Role and permissions for the full RBAC model