chore: Quick refactor to usePolicy hook (#3161)

This commit is contained in:
Tom Moor
2022-02-23 21:33:18 -08:00
committed by GitHub
parent 4c95674ef0
commit a3b8e7a65e
29 changed files with 90 additions and 64 deletions

12
app/hooks/usePolicy.ts Normal file
View File

@@ -0,0 +1,12 @@
import useStores from "./useStores";
/**
* Quick access to retrieve the abilities of a policy for a given entity
*
* @param entityId The entity id
* @returns The available abilities
*/
export default function usePolicy(entityId: string) {
const { policies } = useStores();
return policies.abilities(entityId);
}