Skip to content

The complete open source platform to run your entire marketplace. Storefront, vendor panel, admin console, and integrations in one enterprise-grade platform you own.

386 B
Raw Blame
import type { PermissionKey, PermissionRight } from "@mercurjs/dashboard-sdk"
import { usePermissions } from "./use-permissions"

/**
 * @example
 * ```tsx
 * const canViewCustomers = useCan("customers")
 *
 * useCustomers(query, { enabled: canViewCustomers })
 * ```
 */
export const useCan = (key: PermissionKey, right: PermissionRight = "view") =>
  usePermissions().can(key, right)