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

View File

@@ -9,6 +9,7 @@ import ContextMenu from "~/components/ContextMenu";
import MenuItem from "~/components/ContextMenu/MenuItem";
import OverflowMenuButton from "~/components/ContextMenu/OverflowMenuButton";
import CopyToClipboard from "~/components/CopyToClipboard";
import usePolicy from "~/hooks/usePolicy";
import useStores from "~/hooks/useStores";
import useToasts from "~/hooks/useToasts";
@@ -20,11 +21,11 @@ function ShareMenu({ share }: Props) {
const menu = useMenuState({
modal: true,
});
const { shares, policies } = useStores();
const { shares } = useStores();
const { showToast } = useToasts();
const { t } = useTranslation();
const history = useHistory();
const can = policies.abilities(share.id);
const can = usePolicy(share.id);
const handleGoToDocument = React.useCallback(
(ev: React.SyntheticEvent) => {