Merge commit 'd803bfe2b1fe7f5e219e50ac20d6801a0a58ac75' as 'vendor/ruvector'
This commit is contained in:
40
vendor/ruvector/npm/packages/cognitum-gate-wasm/examples/react-hook.d.ts
vendored
Normal file
40
vendor/ruvector/npm/packages/cognitum-gate-wasm/examples/react-hook.d.ts
vendored
Normal file
@@ -0,0 +1,40 @@
|
||||
/**
|
||||
* React Hook Example
|
||||
*
|
||||
* This example shows how to use Cognitum Gate in React applications
|
||||
* with a custom hook for action permission.
|
||||
*
|
||||
* Usage in your React app:
|
||||
* import { useGate, GateProvider } from './react-hook';
|
||||
*/
|
||||
import { ReactNode } from 'react';
|
||||
interface GateProviderProps {
|
||||
children: ReactNode;
|
||||
config?: {
|
||||
minCut?: number;
|
||||
maxShift?: number;
|
||||
storage?: 'memory' | 'indexeddb';
|
||||
};
|
||||
}
|
||||
export declare function GateProvider({ children, config }: GateProviderProps): any;
|
||||
export declare function useGate(): any;
|
||||
export declare function usePermitAction(): {
|
||||
requestPermit: any;
|
||||
isLoading: any;
|
||||
error: any;
|
||||
lastResult: any;
|
||||
isReady: any;
|
||||
};
|
||||
interface ProtectedButtonProps {
|
||||
actionId: string;
|
||||
actionType: string;
|
||||
target: string;
|
||||
onPermitted: (token: string) => void;
|
||||
onDeferred: (sequence: number) => void;
|
||||
onDenied: (reason: string) => void;
|
||||
children: ReactNode;
|
||||
}
|
||||
export declare function ProtectedButton({ actionId, actionType, target, onPermitted, onDeferred, onDenied, children, }: ProtectedButtonProps): any;
|
||||
export declare function ExampleApp(): any;
|
||||
export default ExampleApp;
|
||||
//# sourceMappingURL=react-hook.d.ts.map
|
||||
Reference in New Issue
Block a user