Skip to content

armgit / kaneo

Public Imported from GitHub
0

⚡ Project management that doesn't become the project. Boards, Gantt charts, and GitHub integration. Self-host it or use Kaneo Cloud.

517 B
Raw Blame
import { useEffect, useState } from "react";
import { useWorkspacePermission } from "@/hooks/use-workspace-permission";

export function useCanShareProject() {
  const { hasPermission } = useWorkspacePermission();
  const [canShare, setCanShare] = useState(false);

  useEffect(() => {
    let cancelled = false;
    void hasPermission({ project: ["share"] }).then((ok) => {
      if (!cancelled) setCanShare(ok);
    });
    return () => {
      cancelled = true;
    };
  }, [hasPermission]);

  return canShare;
}