UNPKG

@nangazaki/vue-rbac

Version:

Role-Based Access Control (RBAC) implementation for Vue.js

24 lines (23 loc) 1.03 kB
import type { RBACConfig, RBACState, RolesConfig } from "../types/index"; /** * Loads RBAC configuration from a remote endpoint and updates the state. * * @param state - The current RBAC state object to be updated * @param options - Required configuration options including API endpoint and fetch options * @param mergeWithExisting - When true, merges the loaded config with existing roles. When false, replaces entirely * @returns Promise resolving to the updated roles configuration * @throws {Error} When the fetch request fails or returns a non-ok status * * @example * ```typescript * const state = createRBACState(); * const options = { * apiEndpoint: 'https://api.example.com/rbac', * fetchOptions: { headers: { 'Authorization': 'Bearer token' } }, * transformResponse: (data) => data * }; * * const roles = await loadDynamicConfig(state, options); * ``` */ export declare function loadDynamicConfig(state: RBACState, options: Required<RBACConfig>, mergeWithExisting?: boolean): Promise<RolesConfig>;