UNPKG

ra-core

Version:

Core components of react-admin, a frontend Framework for building admin applications on top of REST services, using ES6, React

42 lines 1.16 kB
/** * Get a callback for calling the authProvider.getPermissions() method. * * @see useAuthProvider * * @returns {Function} getPermissions callback * * This is a low level hook. See those more specialized hooks * offering state handling. * * @see usePermissions * * @example * * import { useGetPermissions } from 'react-admin'; * * const Roles = () => { * const [permissions, setPermissions] = useState([]); * const getPermissions = useGetPermissions(); * useEffect(() => { * getPermissions().then(permissions => setPermissions(permissions)) * }, []) * return ( * <ul> * {permissions.map((permission, key) => ( * <li key={key}>{permission}</li> * ))} * </ul> * ); * } */ declare const useGetPermissions: () => GetPermissions; /** * Proxy for calling authProvider.getPermissions() * * @param {Object} params The parameters to pass to the authProvider * * @return {Promise} The authProvider response */ type GetPermissions = (params?: any) => Promise<any>; export default useGetPermissions; //# sourceMappingURL=useGetPermissions.d.ts.map